The sgcAI OpenAI component enables Delphi teams para ship smart, revenue-ready experiences that blend natural language understanding, code generation, e conversation flows into existing VCL e FMX products. Com um single drop-in component, SaaS vendors can offer AI-driven assistants, automated documentação, ou multilingual chat sem rebuilding their infrastructure.
Por que um componente OpenAI acelera projetos comerciais
- Faster go-to-market: ready-made REST, WebSocket, e streaming support reduces integration time um partir de weeks para hours.
- Enterprise-grade security: TLS 1.3, HTTP/2, e proxy compatibility protect customer data across regulated deployments.
- Scalable monetization: multi-tenant token management e rate limiting let ISVs resell AI features como premium adicionar-ons.
- Cross-platform reach: o same component works across Windows, macOS, Linux, iOS, e Android targets built com Delphi.
Preparando um componente OpenAI no Delphi
- Install o latest sgcWebSockets package e ensure o sgcAI_OpenAI unit is available em your project.
- Create um OpenAI chave de API no OpenAI dashboard e store it securely (environment variable, encrypted INI, ou secrets vault).
- Adicionar sgcAI.OpenAI para o uses clause de your form ou data module.
Configuração Exemplo (VCL Form)
The snippet abaixo configures um TsgcOpenAI component em runtime. Drop um TButton, TMemo, e TListBox no form para visualize o conversation.
uses
System.SysUtils, sgcAI_OpenAI;
procedure TFormMain.FormCreate(Sender: TObject);
begin
OpenAI := TsgcOpenAI.Create(Self);
OpenAI.APIKey := GetEnvironmentVariable('OPENAI_API_KEY');
OpenAI.DefaultModel := 'gpt-4o-mini';
OpenAI.HTTP.Proxy.Host := 'proxy.company.local';
OpenAI.HTTP.Proxy.Port := 8080;
OpenAI.HTTP.Timeout := 15000;
OpenAI.Streaming := True;
end;
procedure TFormMain.ButtonAskClick(Sender: TObject);
var
LRequest: TsgcOpenAIChatRequest;
LResponse: TsgcOpenAIChatResponse;
begin
LRequest := TsgcOpenAIChatRequest.Create;
try
LRequest.Messages.Add('system', 'Answer as a senior support engineer.');
LRequest.Messages.Add('user', MemoPrompt.Lines.Text);
LResponse := OpenAI.Chat.Create(LRequest);
try
ListBoxHistory.Items.Add(LResponse.Choices[0].Message.Content);
finally
LResponse.Free;
end;
finally
LRequest.Free;
end;
end;
Amplie suas Oportunidades
Delphi vendors can unlock new revenue streams por packaging AI copilots, knowledge search, e audio transcription como inscrição tiers. With built-in analytics events e token accounting, it is straightforward para measure engagement, justify upsells, e build personalized customer success workflows.
