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 OllamaClientInterfaceMock
- func (mmChat *OllamaClientInterfaceMock) Chat(c1 ChatRequest) (c2 ChatResponse, err error)
- func (mmChat *OllamaClientInterfaceMock) ChatAfterCounter() uint64
- func (mmChat *OllamaClientInterfaceMock) ChatBeforeCounter() uint64
- func (mmEmbed *OllamaClientInterfaceMock) Embed(e1 EmbedRequest) (e2 EmbedResponse, err error)
- func (mmEmbed *OllamaClientInterfaceMock) EmbedAfterCounter() uint64
- func (mmEmbed *OllamaClientInterfaceMock) EmbedBeforeCounter() uint64
- func (mmIsAutoPull *OllamaClientInterfaceMock) IsAutoPull() (b1 bool)
- func (mmIsAutoPull *OllamaClientInterfaceMock) IsAutoPullAfterCounter() uint64
- func (mmIsAutoPull *OllamaClientInterfaceMock) IsAutoPullBeforeCounter() uint64
- func (m *OllamaClientInterfaceMock) MinimockChatDone() bool
- func (m *OllamaClientInterfaceMock) MinimockChatInspect()
- func (m *OllamaClientInterfaceMock) MinimockEmbedDone() bool
- func (m *OllamaClientInterfaceMock) MinimockEmbedInspect()
- func (m *OllamaClientInterfaceMock) MinimockFinish()
- func (m *OllamaClientInterfaceMock) MinimockIsAutoPullDone() bool
- func (m *OllamaClientInterfaceMock) MinimockIsAutoPullInspect()
- func (m *OllamaClientInterfaceMock) MinimockWait(timeout mm_time.Duration)
- type OllamaClientInterfaceMockChatExpectation
- type OllamaClientInterfaceMockChatParamPtrs
- type OllamaClientInterfaceMockChatParams
- type OllamaClientInterfaceMockChatResults
- type OllamaClientInterfaceMockEmbedExpectation
- type OllamaClientInterfaceMockEmbedParamPtrs
- type OllamaClientInterfaceMockEmbedParams
- type OllamaClientInterfaceMockEmbedResults
- type OllamaClientInterfaceMockIsAutoPullExpectation
- type OllamaClientInterfaceMockIsAutoPullResults
- type OllamaModelInfo
- type OllamaOptions
- type OllamaSetup
- type PullModelRequest
- type PullModelResponse
- type TaskTextEmbeddingsInput
- type TaskTextEmbeddingsOutput
- type TaskTextGenerationChatInput
- type TaskTextGenerationChatOuput
- type URL
Constants ¶
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 OllamaClientInterfaceMock ¶
type OllamaClientInterfaceMock struct { ChatMock mOllamaClientInterfaceMockChat EmbedMock mOllamaClientInterfaceMockEmbed IsAutoPullMock mOllamaClientInterfaceMockIsAutoPull // contains filtered or unexported fields }
OllamaClientInterfaceMock implements OllamaClientInterface
func NewOllamaClientInterfaceMock ¶
func NewOllamaClientInterfaceMock(t minimock.Tester) *OllamaClientInterfaceMock
NewOllamaClientInterfaceMock returns a mock for OllamaClientInterface
func (*OllamaClientInterfaceMock) Chat ¶
func (mmChat *OllamaClientInterfaceMock) Chat(c1 ChatRequest) (c2 ChatResponse, err error)
Chat implements OllamaClientInterface
func (*OllamaClientInterfaceMock) ChatAfterCounter ¶
func (mmChat *OllamaClientInterfaceMock) ChatAfterCounter() uint64
ChatAfterCounter returns a count of finished OllamaClientInterfaceMock.Chat invocations
func (*OllamaClientInterfaceMock) ChatBeforeCounter ¶
func (mmChat *OllamaClientInterfaceMock) ChatBeforeCounter() uint64
ChatBeforeCounter returns a count of OllamaClientInterfaceMock.Chat invocations
func (*OllamaClientInterfaceMock) Embed ¶
func (mmEmbed *OllamaClientInterfaceMock) Embed(e1 EmbedRequest) (e2 EmbedResponse, err error)
Embed implements OllamaClientInterface
func (*OllamaClientInterfaceMock) EmbedAfterCounter ¶
func (mmEmbed *OllamaClientInterfaceMock) EmbedAfterCounter() uint64
EmbedAfterCounter returns a count of finished OllamaClientInterfaceMock.Embed invocations
func (*OllamaClientInterfaceMock) EmbedBeforeCounter ¶
func (mmEmbed *OllamaClientInterfaceMock) EmbedBeforeCounter() uint64
EmbedBeforeCounter returns a count of OllamaClientInterfaceMock.Embed invocations
func (*OllamaClientInterfaceMock) IsAutoPull ¶
func (mmIsAutoPull *OllamaClientInterfaceMock) IsAutoPull() (b1 bool)
IsAutoPull implements OllamaClientInterface
func (*OllamaClientInterfaceMock) IsAutoPullAfterCounter ¶
func (mmIsAutoPull *OllamaClientInterfaceMock) IsAutoPullAfterCounter() uint64
IsAutoPullAfterCounter returns a count of finished OllamaClientInterfaceMock.IsAutoPull invocations
func (*OllamaClientInterfaceMock) IsAutoPullBeforeCounter ¶
func (mmIsAutoPull *OllamaClientInterfaceMock) IsAutoPullBeforeCounter() uint64
IsAutoPullBeforeCounter returns a count of OllamaClientInterfaceMock.IsAutoPull invocations
func (*OllamaClientInterfaceMock) MinimockChatDone ¶
func (m *OllamaClientInterfaceMock) MinimockChatDone() bool
MinimockChatDone returns true if the count of the Chat invocations corresponds the number of defined expectations
func (*OllamaClientInterfaceMock) MinimockChatInspect ¶
func (m *OllamaClientInterfaceMock) MinimockChatInspect()
MinimockChatInspect logs each unmet expectation
func (*OllamaClientInterfaceMock) MinimockEmbedDone ¶
func (m *OllamaClientInterfaceMock) MinimockEmbedDone() bool
MinimockEmbedDone returns true if the count of the Embed invocations corresponds the number of defined expectations
func (*OllamaClientInterfaceMock) MinimockEmbedInspect ¶
func (m *OllamaClientInterfaceMock) MinimockEmbedInspect()
MinimockEmbedInspect logs each unmet expectation
func (*OllamaClientInterfaceMock) MinimockFinish ¶
func (m *OllamaClientInterfaceMock) MinimockFinish()
MinimockFinish checks that all mocked methods have been called the expected number of times
func (*OllamaClientInterfaceMock) MinimockIsAutoPullDone ¶
func (m *OllamaClientInterfaceMock) MinimockIsAutoPullDone() bool
MinimockIsAutoPullDone returns true if the count of the IsAutoPull invocations corresponds the number of defined expectations
func (*OllamaClientInterfaceMock) MinimockIsAutoPullInspect ¶
func (m *OllamaClientInterfaceMock) MinimockIsAutoPullInspect()
MinimockIsAutoPullInspect logs each unmet expectation
func (*OllamaClientInterfaceMock) MinimockWait ¶
func (m *OllamaClientInterfaceMock) MinimockWait(timeout mm_time.Duration)
MinimockWait waits for all mocked methods to be called the expected number of times
type OllamaClientInterfaceMockChatExpectation ¶
type OllamaClientInterfaceMockChatExpectation struct { Counter uint64 // contains filtered or unexported fields }
OllamaClientInterfaceMockChatExpectation specifies expectation struct of the OllamaClientInterface.Chat
func (*OllamaClientInterfaceMockChatExpectation) Then ¶
func (e *OllamaClientInterfaceMockChatExpectation) Then(c2 ChatResponse, err error) *OllamaClientInterfaceMock
Then sets up OllamaClientInterface.Chat return parameters for the expectation previously defined by the When method
type OllamaClientInterfaceMockChatParamPtrs ¶
type OllamaClientInterfaceMockChatParamPtrs struct {
// contains filtered or unexported fields
}
OllamaClientInterfaceMockChatParamPtrs contains pointers to parameters of the OllamaClientInterface.Chat
type OllamaClientInterfaceMockChatParams ¶
type OllamaClientInterfaceMockChatParams struct {
// contains filtered or unexported fields
}
OllamaClientInterfaceMockChatParams contains parameters of the OllamaClientInterface.Chat
type OllamaClientInterfaceMockChatResults ¶
type OllamaClientInterfaceMockChatResults struct {
// contains filtered or unexported fields
}
OllamaClientInterfaceMockChatResults contains results of the OllamaClientInterface.Chat
type OllamaClientInterfaceMockEmbedExpectation ¶
type OllamaClientInterfaceMockEmbedExpectation struct { Counter uint64 // contains filtered or unexported fields }
OllamaClientInterfaceMockEmbedExpectation specifies expectation struct of the OllamaClientInterface.Embed
func (*OllamaClientInterfaceMockEmbedExpectation) Then ¶
func (e *OllamaClientInterfaceMockEmbedExpectation) Then(e2 EmbedResponse, err error) *OllamaClientInterfaceMock
Then sets up OllamaClientInterface.Embed return parameters for the expectation previously defined by the When method
type OllamaClientInterfaceMockEmbedParamPtrs ¶
type OllamaClientInterfaceMockEmbedParamPtrs struct {
// contains filtered or unexported fields
}
OllamaClientInterfaceMockEmbedParamPtrs contains pointers to parameters of the OllamaClientInterface.Embed
type OllamaClientInterfaceMockEmbedParams ¶
type OllamaClientInterfaceMockEmbedParams struct {
// contains filtered or unexported fields
}
OllamaClientInterfaceMockEmbedParams contains parameters of the OllamaClientInterface.Embed
type OllamaClientInterfaceMockEmbedResults ¶
type OllamaClientInterfaceMockEmbedResults struct {
// contains filtered or unexported fields
}
OllamaClientInterfaceMockEmbedResults contains results of the OllamaClientInterface.Embed
type OllamaClientInterfaceMockIsAutoPullExpectation ¶
type OllamaClientInterfaceMockIsAutoPullExpectation struct { Counter uint64 // contains filtered or unexported fields }
OllamaClientInterfaceMockIsAutoPullExpectation specifies expectation struct of the OllamaClientInterface.IsAutoPull
type OllamaClientInterfaceMockIsAutoPullResults ¶
type OllamaClientInterfaceMockIsAutoPullResults struct {
// contains filtered or unexported fields
}
OllamaClientInterfaceMockIsAutoPullResults contains results of the OllamaClientInterface.IsAutoPull
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"`
}