AI ChatBot Component

Build conversational AI interfaces with human-like interactions. Powered by leading AI models, integrated natively in Delphi.

TsgcAIOpenAIChatBot

Plug-and-play voice chatbot — capture microphone audio, transcribe with Whisper, send to ChatCompletions, speak the answer back through a text-to-speech provider.

Component class

TsgcAIOpenAIChatBot

Protocol

Voice front-end on top of OpenAI Whisper + Chat Completions

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Enterprise (AI add-on)

Drop the component, set a few properties, go

Plug an AudioRecorder + TextToSpeech into a TsgcAIOpenAIChatBot, set the API key, call Start.

uses
  sgcAI, sgcAI_OpenAI, sgcAI_OpenAI_Audio_ChatBot,
  sgcAI_AudioRecorder_MCI, sgcAI_TextToSpeech_System;

var
  ChatBot: TsgcAIOpenAIChatBot;
  Recorder: TsgcAudioRecorderMCI;
  TTS:      TsgcTextToSpeechSystem;
begin
  Recorder := TsgcAudioRecorderMCI.Create(nil);
  TTS      := TsgcTextToSpeechSystem.Create(nil);

  ChatBot := TsgcAIOpenAIChatBot.Create(nil);
  ChatBot.OpenAIOptions.ApiKey := 'sk-...';
  ChatBot.AudioRecorder := Recorder;
  ChatBot.TextToSpeech  := TTS;

  ChatBot.OnAudioStart     := ChatBotAudioStart;
  ChatBot.OnAudioStop      := ChatBotAudioStop;
  ChatBot.OnTranscription  := ChatBotTranscription;
  ChatBot.OnChatCompletion := ChatBotChatCompletion;

  ChatBot.Start;  // begin microphone capture; Stop ends it

  // You can also push a turn programmatically:
  ChatBot.ChatAsUser('Tell me a joke about Delphi');
end;

procedure TForm1.ChatBotChatCompletion(Sender: TObject;
  const Role, Content: string);
begin
  memoLog.Lines.Add(Role + ': ' + Content);
end;

What's inside

6 published properties, 4 methods, 4 events — pulled from the component reference.

Configuration

Published properties: OpenAIOptions, ChatBotOptions.

Diagnostics

Published properties: Version.

Audio

Properties: TextToSpeech, AudioRecorder.

RAG

Properties: Embeddings.

Chat

Methods: ChatAsUser, ChatAsSystem.

Session

Methods: Start, Stop.

Specifications & references

Authoritative sources for the protocols this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — TsgcAIOpenAIChatBot Full property, method and event reference for this component.
Demo Project — Demos\AI\ChatBot Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Start Building AI ChatBots Today

Download the free trial and add conversational AI to your Delphi applications in minutes.