go-ollama
Ergonomic Go wrapper around github.com/ollama/ollama/api.
Quick start
client, err := gollama.FromEnv()
if err != nil {
log.Fatal(err)
}
names, _ := client.ModelNames(ctx)
reply, _ := client.Complete(ctx, "Say hi.", gollama.WithModel("llama3.2"))
fmt.Println(reply.Text)
Install
go get gitea.neitzel.de/konrad/go-ollama
Configuration
OLLAMA_HOST— Ollama server URL (defaulthttp://127.0.0.1:11434)- Client defaults:
WithDefaultModel,WithDefaultOptions
API overview
- Models:
ModelNames,Pull,Show,Delete,RunningModels - Simple:
Complete,Chat - History:
ChatMessages,Session - Structured:
CompleteJSON,ChatJSON - Streaming:
CompleteStream,ChatStream - Embeddings:
Embed
See docs/project-specification.md for details.
Tests
go test ./...
go test -tags=integration ./...
Integration defaults live in testconfig/defaults.toml (http://debian:11434). Copy testconfig/local.toml.example to testconfig/local.toml to override.
Description
Languages
Go
100%