go-ollama/README.md
2026-06-11 20:01:48 +02:00

48 lines
1.1 KiB
Markdown

# go-ollama
Ergonomic Go wrapper around [`github.com/ollama/ollama/api`](https://github.com/ollama/ollama/tree/main/api).
## Quick start
```go
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
```bash
go get gitea.neitzel.de/konrad/go-ollama
```
## Configuration
- `OLLAMA_HOST` — Ollama server URL (default `http://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](docs/project-specification.md) for details.
## Tests
```bash
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.