ollama

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package ollama wires local Ollama chat models into loom-mcp planners.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements model.Client using Ollama's /api/chat endpoint.

func New

func New(opts Options) (*Client, error)

New builds an Ollama-backed model client from the provided options.

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, req *model.Request) (*model.Response, error)

Complete renders a non-streaming response using Ollama's chat API.

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, req *model.Request) (model.Streamer, error)

Stream renders a streaming response using Ollama's chat API.

type Options

type Options struct {
	// HTTPClient is used for requests. When nil, a client is created from Timeout.
	HTTPClient *http.Client

	// ServerURL is the local Ollama base URL, for example http://localhost:11434.
	ServerURL string

	// DefaultModel is the model identifier used when Request.Model is empty.
	DefaultModel string

	// HighModel is used when Request.ModelClass is high-reasoning and
	// Request.Model is empty.
	HighModel string

	// SmallModel is used when Request.ModelClass is small and Request.Model is
	// empty.
	SmallModel string

	// MaxTokens is mapped to Ollama's num_predict option when Request.MaxTokens
	// is unset.
	MaxTokens int

	// Temperature is the default sampling temperature when Request.Temperature
	// is unset.
	Temperature float32

	// Timeout configures the response header timeout when HTTPClient is nil.
	// Request lifetime deadlines should be owned by the request context.
	Timeout time.Duration
}

Options configures the Ollama adapter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL