Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterModel ¶
func RegisterModel(modelName string, constructor ModelConstructor)
RegisterModel allows LLM providers to register their constructors. This function is intended to be called from the init() function of provider packages.
Types ¶
type ChatChoice ¶
type ChatChoice struct {
Index int `json:"index"`
Message ChatMessage `json:"message"`
FinishReason string `json:"finish_reason"`
}
type ChatMessage ¶
type ChatResponse ¶
type ChatResponse struct {
Text string `json:"text"`
}
type ChatStructure ¶
type ChatStructure struct {
Messages []ChatMessage `json:"messages"`
}
type LLM ¶
type LLM interface {
Chat(structure ChatStructure) (*ChatResponse, error)
}
type ModelConstructor ¶
ModelConstructor defines the function signature for creating an LLM instance. It takes apiKey and an optional apiURL.
type OpenAIModel ¶ added in v0.1.1
type OpenAIModel struct {
// contains filtered or unexported fields
}
OpenAIModel implements the gollm.LLM interface for OpenAI models.
func NewOpenAiModel ¶ added in v0.1.1
func NewOpenAiModel(modelName string, apiKey string, apiURL string) (*OpenAIModel, error)
NewOpenAiModel creates a new instance of OpenAIModel. This is the function that will be registered with the factory.
func (*OpenAIModel) Chat ¶ added in v0.1.1
func (m *OpenAIModel) Chat(structure ChatStructure) (*ChatResponse, error)
Chat implements the gollm.LLM interface.
Click to show internal directories.
Click to hide internal directories.