Documentation
¶
Index ¶
- Variables
- func ConvertParametersToSchema(params any) (any, error)
- type Client
- func (c *Client) CreateBatchEmbedding(ctx context.Context, texts []string) (*base.BatchEmbeddingResult, error)
- func (c *Client) CreateChatCompletionStream(ctx context.Context, messages []chat.Message, requestTools []tools.Tool) (chat.MessageStream, error)
- func (c *Client) CreateEmbedding(ctx context.Context, text string) (*base.EmbeddingResult, error)
- func (c *Client) Rerank(ctx context.Context, query string, documents []types.Document, criteria string) ([]float64, error)
- func (c *Client) Unload(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotInstalled = errors.New("docker model runner is not available\nplease install it and try again (https://docs.docker.com/ai/model-runner/get-started/)")
ErrNotInstalled is returned when Docker Model Runner is not installed.
Functions ¶
func ConvertParametersToSchema ¶
ConvertParametersToSchema converts parameters to DMR Schema format
Types ¶
type Client ¶
Client represents an DMR client wrapper It implements the provider.Provider interface
func (*Client) CreateBatchEmbedding ¶
func (c *Client) CreateBatchEmbedding(ctx context.Context, texts []string) (*base.BatchEmbeddingResult, error)
CreateBatchEmbedding generates embedding vectors for multiple texts with usage tracking.
func (*Client) CreateChatCompletionStream ¶
func (c *Client) CreateChatCompletionStream(ctx context.Context, messages []chat.Message, requestTools []tools.Tool) (chat.MessageStream, error)
CreateChatCompletionStream creates a streaming chat completion request It returns a stream that can be iterated over to get completion chunks
func (*Client) CreateEmbedding ¶
CreateEmbedding generates an embedding vector for the given text with usage tracking.
func (*Client) Rerank ¶
func (c *Client) Rerank(ctx context.Context, query string, documents []types.Document, criteria string) ([]float64, error)
Rerank scores documents by relevance to the query using a reranking model. Returns relevance scores in the same order as input documents.
func (*Client) Unload ¶ added in v1.57.0
Unload asks Docker Model Runner to release the resources held for the configured model. Invoked by the runtime's `unload` on_agent_switch builtin hook.
The unload endpoint is the provider's `unload_api` (relative path or absolute URL) when set, otherwise [defaultUnloadURL] derived from the OpenAI base URL. When neither is available the call is a no-op.