Documentation ¶
Index ¶
- Constants
- func Init(bc base.Component) *component
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type EmbedRequest
- type EmbedResponse
- type ListLocalModelsRequest
- type ListLocalModelsResponse
- type MultiModalContent
- type OllamaChatMessage
- type OllamaClient
- func (c *OllamaClient) Chat(request ChatRequest) (ChatResponse, error)
- func (c *OllamaClient) CheckModelAvailability(modelName string) bool
- func (c *OllamaClient) Embed(request EmbedRequest) (EmbedResponse, error)
- func (c *OllamaClient) IsAutoPull() bool
- func (c *OllamaClient) Pull(modelName string) error
- type OllamaClientInterface
- type OllamaModelInfo
- type OllamaOptions
- type OllamaSetup
- type PullModelRequest
- type PullModelResponse
- type TaskTextEmbeddingsInput
- type TaskTextEmbeddingsOutput
- type TaskTextGenerationChatInput
- type TaskTextGenerationChatOuput
- type URL
Constants ¶
View Source
const ( TaskTextGenerationChat = "TASK_TEXT_GENERATION_CHAT" TaskTextEmbeddings = "TASK_TEXT_EMBEDDINGS" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChatMessage ¶
type ChatMessage struct { Role string `json:"role"` Content []MultiModalContent `json:"content"` }
type ChatRequest ¶
type ChatRequest struct { Model string `json:"model"` Messages []OllamaChatMessage `json:"messages"` Stream bool `json:"stream"` Options OllamaOptions `json:"options"` }
type ChatResponse ¶
type ChatResponse struct { Model string `json:"model"` CreatedAt string `json:"created_at"` Message OllamaChatMessage `json:"message"` Done bool `json:"done"` DoneReason string `json:"done_reason"` TotalDuration int `json:"total_duration"` LoadDuration int `json:"load_duration"` PromptEvalCount int `json:"prompt_eval_count"` PromptEvalDuration int `json:"prompt_eval_duration"` EvalCount int `json:"eval_count"` EvalDuration int `json:"eval_duration"` }
type EmbedRequest ¶
type EmbedResponse ¶
type EmbedResponse struct {
Embedding []float32 `json:"embedding"`
}
type ListLocalModelsRequest ¶
type ListLocalModelsRequest struct { }
type ListLocalModelsResponse ¶
type ListLocalModelsResponse struct {
Models []OllamaModelInfo `json:"models"`
}
type MultiModalContent ¶
type OllamaChatMessage ¶
type OllamaClient ¶
type OllamaClient struct {
// contains filtered or unexported fields
}
func (*OllamaClient) Chat ¶
func (c *OllamaClient) Chat(request ChatRequest) (ChatResponse, error)
func (*OllamaClient) CheckModelAvailability ¶
func (c *OllamaClient) CheckModelAvailability(modelName string) bool
func (*OllamaClient) Embed ¶
func (c *OllamaClient) Embed(request EmbedRequest) (EmbedResponse, error)
func (*OllamaClient) IsAutoPull ¶
func (c *OllamaClient) IsAutoPull() bool
func (*OllamaClient) Pull ¶
func (c *OllamaClient) Pull(modelName string) error
type OllamaClientInterface ¶
type OllamaClientInterface interface { Chat(ChatRequest) (ChatResponse, error) Embed(EmbedRequest) (EmbedResponse, error) IsAutoPull() bool }
type OllamaModelInfo ¶
type OllamaModelInfo struct { Name string `json:"name"` ModifiedAt string `json:"modified_at"` Size int `json:"size"` Dijest string `json:"digest"` Details struct { Format string `json:"format"` Family string `json:"family"` Families string `json:"families"` ParameterSize string `json:"parameter_size"` QuantizationLevel string `json:"quantization_level"` } `json:"details"` }
type OllamaOptions ¶
type OllamaSetup ¶
type PullModelRequest ¶
type PullModelResponse ¶
type PullModelResponse struct { }
type TaskTextEmbeddingsInput ¶
type TaskTextEmbeddingsOutput ¶
type TaskTextEmbeddingsOutput struct {
Embedding []float32 `json:"embedding"`
}
type TaskTextGenerationChatInput ¶
type TaskTextGenerationChatInput struct { ChatHistory []ChatMessage `json:"chat-history"` MaxNewTokens int `json:"max-new-tokens"` Model string `json:"model"` Prompt string `json:"prompt"` PromptImages []string `json:"prompt-images"` Seed int `json:"seed"` SystemMsg string `json:"system-message"` Temperature float32 `json:"temperature"` TopK int `json:"top-k"` }
type TaskTextGenerationChatOuput ¶
type TaskTextGenerationChatOuput struct {
Text string `json:"text"`
}
Click to show internal directories.
Click to hide internal directories.