ollama

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

ollama implements an API client for the Ollama provider. https://github.com/ollama/ollama/tree/main/docs/api

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.Client
	*modelcache.ModelCache
	// contains filtered or unexported fields
}

func New

func New(endPoint string, opts ...client.ClientOpt) (*Client, error)

Create a new client, with an ollama endpoint, which should be something like "http://localhost:11434/api" - you can specify a different provider name in the fragment, ie, "http://localhost:11434/api#myprovider"

func (*Client) DeleteModel

func (ollama *Client) DeleteModel(ctx context.Context, model schema.Model) error

Delete a model by name

func (*Client) DownloadModel

func (ollama *Client) DownloadModel(ctx context.Context, name string, opts ...opt.Opt) (*schema.Model, error)

Download (pull) a model by name

func (*Client) GetModel

func (ollama *Client) GetModel(ctx context.Context, name string, opts ...opt.Opt) (*schema.Model, error)

GetModel returns the model with the given name

func (*Client) ListModels

func (ollama *Client) ListModels(ctx context.Context, opts ...opt.Opt) ([]schema.Model, error)

List all models in the Ollama registry

func (*Client) ListRunningModels

func (ollama *Client) ListRunningModels(ctx context.Context) ([]schema.Model, error)

List running models

func (*Client) LoadModel

func (ollama *Client) LoadModel(ctx context.Context, model schema.Model) error

Load a model into memory

func (*Client) Name

func (c *Client) Name() string

Name returns the provider name

func (*Client) UnloadModel

func (ollama *Client) UnloadModel(ctx context.Context, model schema.Model) error

Unload a model from memory

type ModelDetails

type ModelDetails struct {
	ParentModel       string   `json:"parent_model,omitempty"`
	Format            string   `json:"format"`
	Family            string   `json:"family"`
	Families          []string `json:"families"`
	ParameterSize     string   `json:"parameter_size"`
	QuantizationLevel string   `json:"quantization_level"`
}

ModelDetails are the details of the model

type ModelInfo

type ModelInfo map[string]any

ModelInfo provides additional model parameters

type PullStatus

type PullStatus struct {
	Status         string `json:"status"`
	DigestName     string `json:"digest,omitempty"`
	TotalBytes     int64  `json:"total,omitempty"`
	CompletedBytes int64  `json:"completed,omitempty"`
}

PullStatus provides the status of a pull operation in a callback function

Jump to

Keyboard shortcuts

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