Documentation ¶
Overview ¶
Package llm contains the language model provider interface and its implementations.
Index ¶
Constants ¶
const ( // DefaultPromptTemplate is the default template for generating a prompt DefaultPromptTemplate = `` /* 525-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fake ¶
type Fake struct { }
Fake is a fake language model provider
func (*Fake) GetResponse ¶
GetResponse returns a response from the language model provider
func (*Fake) HealthCheck ¶
HealthCheck checks the health of the language model provider
type HTTPClient ¶
HTTPClient is an interface for an HTTP client
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) RegisterRoutes ¶
func (m *Manager) RegisterRoutes(r chi.Router)
type NoOpsLLM ¶
type NoOpsLLM struct {
// contains filtered or unexported fields
}
NoOpsLLM is a language model provider that does nothing
func NewNoOpsLLM ¶
func NewNoOpsLLM(settings *types.NoOpLLMProviderSettings) *NoOpsLLM
NewNoOpsLLM creates a new NoOpsLLM with the given settings
func (*NoOpsLLM) GetResponse ¶
GetResponse returns a response from the language model provider
func (*NoOpsLLM) HealthCheck ¶
HealthCheck checks the health of the language model provider
type OpenAILLM ¶
type OpenAILLM struct {
// contains filtered or unexported fields
}
OpenAILLM is a language model provider that uses OpenAI to generate responses
func NewOpenAILLM ¶
func NewOpenAILLM(settings *types.OpenAILLMSettings, client HTTPClient, logging *logrus.Logger) *OpenAILLM
NewOpenAILLM creates a new OpenAILLM with the given settings
func (*OpenAILLM) GetResponse ¶
GetResponse returns a response from the language model provider
func (*OpenAILLM) HealthCheck ¶
HealthCheck checks the health of the language model provider
type PromptGenerator ¶
type PromptGenerator struct {
// contains filtered or unexported fields
}
PromptGenerator is a struct that generates prompts
func NewPromptGenerator ¶
func NewPromptGenerator(logger *logrus.Logger, template PromptTemplate) *PromptGenerator
NewPromptGenerator creates a new prompt generator with the given logger and template
func (*PromptGenerator) GeneratePrompt ¶
func (p *PromptGenerator) GeneratePrompt(data PromptTemplateData) (Prompt, error)
GeneratePrompt generates a prompt with the given data
type PromptTemplate ¶
type PromptTemplate struct {
Template string
}
PromptTemplate is a struct that represents a prompt template
type PromptTemplateData ¶
type PromptTemplateData struct { Query string Documents []Documents ConversationHistories []types.Conversation }
PromptTemplateData is the data used to generate a prompt