ollama

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvider

func NewProvider() (provider provider.Provider)

NewProvider returns an "Ollama" provider.

Types

type Provider

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

Provider holds an "Ollama" provider.

func (*Provider) Available

func (p *Provider) Available(logger *log.Logger) (err error)

Available checks if the provider ready to be used and returns a potential error explaining why not. This might include checking for an installation or making sure an API access token is valid.

func (*Provider) ID

func (p *Provider) ID() (id string)

ID returns the unique ID of this provider.

func (*Provider) Load

func (p *Provider) Load(modelIdentifier string) error

Load loads the given model.

func (*Provider) Models

func (p *Provider) Models() (models []model.Model, err error)

Models returns which models are available to be queried via this provider.

func (*Provider) Pull added in v0.6.0

func (p *Provider) Pull(logger *log.Logger, modelIdentifier string) error

Pull downloads the given model.

func (*Provider) Query

func (p *Provider) Query(ctx context.Context, model model.Model, promptText string) (response string, err error)

Query queries the provider with the given model name.

func (*Provider) SetBinaryPath

func (p *Provider) SetBinaryPath(binaryPath string)

SetBinaryPath sets the binary file path of the Ollama binary.

func (*Provider) SetURL

func (p *Provider) SetURL(url string)

SetURL sets the URL to the Ollama service.

func (*Provider) Start

func (p *Provider) Start(logger *log.Logger) (shutdown func() (err error), err error)

Start starts necessary background services to use this provider and returns a shutdown function.

func (*Provider) Unload

func (p *Provider) Unload(modelIdentifier string) error

Unload unloads the given model.

Jump to

Keyboard shortcuts

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