Documentation
¶
Overview ¶
Package openai provides OpenAI-based LLM (and optionally STT/TTS) for Voxray.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements services.LLMService and optionally services.LLMServiceWithTools.
func NewService ¶
NewService creates an OpenAI LLM service. API key is read from config.GetEnv("OPENAI_API_KEY", "").
func (*Service) Chat ¶
func (s *Service) Chat(ctx context.Context, messages []map[string]any, onToken func(*frames.LLMTextFrame)) error
Chat runs a completion and calls onToken for each streamed content delta (as LLMTextFrame). When tools are registered, tool_calls in the stream are executed and Chat is invoked again with the tool results.
func (*Service) RegisterTool ¶
func (s *Service) RegisterTool(schema schemas.FunctionSchema, handler llmapi.ToolHandler)
RegisterTool implements llmapi.LLMServiceWithTools.
func (*Service) ToolsSchema ¶
func (s *Service) ToolsSchema() *schemas.ToolsSchema
ToolsSchema implements llmapi.LLMServiceWithTools.
Click to show internal directories.
Click to hide internal directories.