Documentation
¶
Overview ¶
Package ollama provides sentinel errors for the Ollama model package.
Package ollama provides an adapter for integrating Ollama models with AgentMesh. It enables local model execution without API keys or cloud dependencies.
Index ¶
- Variables
- func WithModel(modelName string) func(o *Options)
- func WithNumPredict(numPredict int) func(o *Options)
- func WithSeed(seed int) func(o *Options)
- func WithTemperature(temperature float64) func(o *Options)
- func WithTopK(topK int) func(o *Options)
- func WithTopP(topP float64) func(o *Options)
- type Client
- type ClientWrapper
- type Model
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( // ErrYieldFalse is returned when a yield function returns false. ErrYieldFalse = errors.New("model/ollama: yield returned false") // ErrInvalidToolMessage is returned when a tool message is invalid. ErrInvalidToolMessage = errors.New("model/ollama: invalid tool message") )
Functions ¶
func WithNumPredict ¶
WithNumPredict sets the maximum number of tokens to predict. -1 means no limit (default).
func WithSeed ¶
WithSeed sets the random seed for deterministic output. -1 means random seed (default).
func WithTemperature ¶
WithTemperature controls randomness in the output (0.0 to 2.0). Lower values make output more deterministic.
Types ¶
type Client ¶
type Client interface {
Chat(ctx context.Context, req *api.ChatRequest, fn api.ChatResponseFunc) error
Generate(ctx context.Context, req *api.GenerateRequest, fn api.GenerateResponseFunc) error
}
Client defines the interface for interacting with the Ollama API.
type ClientWrapper ¶
type ClientWrapper struct {
// contains filtered or unexported fields
}
ClientWrapper wraps an Ollama client to implement the Client interface.
func NewClientWrapper ¶
func NewClientWrapper(client *api.Client) (*ClientWrapper, error)
NewClientWrapper creates a new ClientWrapper. Returns an error if the client parameter is nil.
func (*ClientWrapper) Chat ¶
func (c *ClientWrapper) Chat(ctx context.Context, req *api.ChatRequest, fn api.ChatResponseFunc) error
Chat implements the Chat method of the Client interface.
func (*ClientWrapper) Generate ¶
func (c *ClientWrapper) Generate(ctx context.Context, req *api.GenerateRequest, fn api.GenerateResponseFunc) error
Generate implements the Generate method of the Client interface.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model wraps the Ollama API client for chat completion.
func NewModelFromClient ¶
NewModelFromClient creates a model from an existing Ollama client. Returns an error if the client is nil.
func NewModelFromClientWrapper ¶
func NewModelFromClientWrapper(wrapper *ClientWrapper, optFns ...func(o *Options)) (*Model, error)
NewModelFromClientWrapper creates a model from a wrapped client. Returns an error if the wrapper is nil.
func (*Model) Capabilities ¶
func (m *Model) Capabilities() model.Capabilities
Capabilities returns the features and limitations of Ollama models.