Documentation
¶
Overview ¶
Package ai manages AI prompts and integrates with LLM providers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidAPIKey = errors.New("invalid API Key") ErrApiKeyNotSet = errors.New("api Key not set") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Completion ¶
Completion sends a prompt to the default provider and returns the response.
func (*Manager) GetPrompts ¶
GetPrompts returns a list of prompts from the database.
func (*Manager) UpdateProvider ¶
UpdateProvider updates a provider.
type OpenAIClient ¶
type OpenAIClient struct {
// contains filtered or unexported fields
}
func NewOpenAIClient ¶
func NewOpenAIClient(apiKey string, lo *logf.Logger) *OpenAIClient
func (*OpenAIClient) SendPrompt ¶
func (o *OpenAIClient) SendPrompt(payload PromptPayload) (string, error)
SendPrompt sends a prompt to the OpenAI API and returns the response text.
type PromptPayload ¶
type PromptPayload struct {
SystemPrompt string `json:"system_prompt"`
UserPrompt string `json:"user_prompt"`
}
PromptPayload represents the structured input for an LLM provider.
type ProviderClient ¶
type ProviderClient interface {
SendPrompt(payload PromptPayload) (string, error)
}
ProviderClient is the interface all providers should implement.
type ProviderType ¶
type ProviderType string
ProviderType is an enum-like type for different providers.
const ( ProviderOpenAI ProviderType = "openai" ProviderClaude ProviderType = "claude" )
Click to show internal directories.
Click to hide internal directories.