ollama

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ollama provides an llm.Provider backed by a local Ollama server's chat API. It is a thin hand-written client over net/http; it pulls in no third-party deps and lives out of the core so the console binary does not link it (it ships as the console-plugin-ollama executable).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ollama

type Ollama struct {
	Model   string
	BaseURL string
	HTTP    *http.Client
}

Ollama is an llm.Provider backed by a local Ollama server's chat API.

func New

func New(opts ...Option) *Ollama

New constructs an Ollama provider. No API key is required. Defaults: Model "llama3.1", BaseURL from OLLAMA_HOST else "http://localhost:11434", and a 120s HTTP client.

func (*Ollama) Complete

func (o *Ollama) Complete(ctx context.Context, req llm.Request) (string, error)

Complete sends a single completion request to the Ollama chat API and returns the text of the assistant's reply.

func (*Ollama) Name

func (o *Ollama) Name() string

Name identifies the provider.

type Option

type Option func(*Ollama)

Option configures an Ollama provider in New.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the server base URL (e.g. to point at a test server).

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets the HTTP client used for requests.

func WithModel

func WithModel(model string) Option

WithModel sets the default model id used when a Request does not specify one.

Jump to

Keyboard shortcuts

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