Documentation
¶
Index ¶
- func Embedder(g *genkit.Genkit, serverAddress string) ai.Embedder
- func IsDefinedEmbedder(g *genkit.Genkit, serverAddress string) bool
- func IsDefinedModel(g *genkit.Genkit, name string) bool
- func Model(g *genkit.Genkit, name string) ai.Model
- func Ptr[T any](v T) *T
- type EmbedOptions
- type GenerateContentConfig
- type ModelDefinition
- type Ollama
- func (o *Ollama) DefineEmbedder(g *genkit.Genkit, serverAddress string, model string, ...) ai.Embedder
- func (o *Ollama) DefineModel(g *genkit.Genkit, model ModelDefinition, opts *ai.ModelOptions) ai.Model
- func (o *Ollama) Init(ctx context.Context) []api.Action
- func (o *Ollama) ListActions(ctx context.Context) []api.ActionDesc
- func (o *Ollama) Name() string
- func (o *Ollama) ResolveAction(atype api.ActionType, name string) api.Action
- type ThinkOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Embedder ¶ added in v0.1.2
Embedder returns the ai.Embedder with the given server address. It returns nil if the embedder was not defined.
func IsDefinedEmbedder ¶ added in v0.1.2
IsDefinedEmbedder reports whether the embedder with the given server address is defined by this plugin.
func IsDefinedModel ¶ added in v0.1.0
IsDefinedModel reports whether a model is defined.
Types ¶
type EmbedOptions ¶ added in v0.1.2
type EmbedOptions struct {
Model string `json:"model"`
}
type GenerateContentConfig ¶ added in v1.6.0
type GenerateContentConfig struct {
// Think controls thinking/reasoning mode.
// Use ThinkEnabled(true/false) for Ollama models, or
// ThinkEffort("low"/"medium"/"high") for GPT-OSS models.
Think *ThinkOption `json:"think,omitempty"`
// Runtime options
Seed *int `json:"seed,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
TopK *int `json:"top_k,omitempty"`
TopP *float64 `json:"top_p,omitempty"`
MinP *float64 `json:"min_p,omitempty"`
Stop []string `json:"stop,omitempty"`
NumCtx *int `json:"num_ctx,omitempty"`
NumPredict *int `json:"num_predict,omitempty"`
// Ollama-specific
KeepAlive string `json:"keep_alive,omitempty"`
}
type ModelDefinition ¶
ModelDefinition represents a model with its name and api.
type Ollama ¶ added in v0.3.0
type Ollama struct {
ServerAddress string // Server address of oLLama.
Timeout int // Response timeout in seconds (defaulted to 30 seconds)
// contains filtered or unexported fields
}
Ollama provides configuration options for the Init function.
func (*Ollama) DefineEmbedder ¶ added in v0.3.0
func (o *Ollama) DefineEmbedder(g *genkit.Genkit, serverAddress string, model string, embedOpts *ai.EmbedderOptions) ai.Embedder
DefineEmbedder defines an embedder with a given server address.
func (*Ollama) DefineModel ¶ added in v0.3.0
func (o *Ollama) DefineModel(g *genkit.Genkit, model ModelDefinition, opts *ai.ModelOptions) ai.Model
func (*Ollama) Init ¶ added in v0.3.0
Init initializes the plugin. Since Ollama models are locally hosted, the plugin doesn't initialize any default models. After downloading a model, call [DefineModel] to use it.
func (*Ollama) ListActions ¶ added in v1.6.0
func (o *Ollama) ListActions(ctx context.Context) []api.ActionDesc
ListActions calls /api/tags to discover locally installed Ollama models.
func (*Ollama) ResolveAction ¶ added in v1.6.0
ResolveAction dynamically creates a model action on demand.
type ThinkOption ¶ added in v1.6.0
type ThinkOption struct {
// contains filtered or unexported fields
}
ThinkOption controls thinking/reasoning behavior for models that support it. Use ThinkEnabled for Ollama models (e.g. deepseek-r1) or ThinkEffort for GPT-OSS models.
func ThinkEffort ¶ added in v1.6.0
func ThinkEffort(level string) *ThinkOption
ThinkEffort creates a ThinkOption with an effort level for GPT-OSS models. Valid values: "low", "medium", "high".
func ThinkEnabled ¶ added in v1.6.0
func ThinkEnabled(enabled bool) *ThinkOption
ThinkEnabled creates a ThinkOption that enables or disables thinking mode. This is used with Ollama models like deepseek-r1.
func (*ThinkOption) IsEnabled ¶ added in v1.6.0
func (t *ThinkOption) IsEnabled() bool
IsEnabled reports whether thinking is active.
func (ThinkOption) JSONSchema ¶ added in v1.6.0
func (ThinkOption) JSONSchema() *jsonschema.Schema
JSONSchema returns a schema allowing either a boolean or a string.
func (ThinkOption) MarshalJSON ¶ added in v1.6.0
func (t ThinkOption) MarshalJSON() ([]byte, error)
func (*ThinkOption) UnmarshalJSON ¶ added in v1.6.0
func (t *ThinkOption) UnmarshalJSON(data []byte) error