Document every exported symbol and how callers use the library.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-29 19:25:43 +02:00
co-authored by Cursor
parent 7b63c8db58
commit f90719583e
5 changed files with 621 additions and 16 deletions
+36 -5
View File
@@ -1,10 +1,41 @@
# go-llm
Go Library for chat LLM calls (`gitea.neitzel.de/konrad/go-llm`). Domain language is in `CONTEXT.md`. Decisions live in the Workspace at `docs/adr/go-llm/`.
Go library for chat LLM calls. One client speaks either the Ollama native protocol or an OpenAI-compatible protocol. Callers pass messages. The library does not load files or build product prompts.
v1: Chat, Stream, List Models, temperature, and max tokens. Adapters: Ollama native (`/api/chat`, `/api/tags`) and OpenAI-compatible (`/v1/chat/completions`, `/v1/models`). No embeddings, tools, raw generate, Nextcloud types, or story types.
Import: `gitea.neitzel.de/konrad/go-llm` (package `gollm`).
```go
client, err := gollm.NewClient(gollm.AdapterOpenAI, "http://localhost:8000", "")
text, err := client.Chat(ctx, []gollm.Message{{Role: gollm.RoleUser, Content: "Hello"}}, gollm.Options{Model: "llama"})
```bash
go get gitea.neitzel.de/konrad/go-llm
```
- [Guide](docs/guide.md) — how to call each capability
- [API](docs/api.md) — every exported symbol
- [Domain language](CONTEXT.md)
## Included
- [Adapters](docs/guide.md#adapters) — Ollama native and OpenAI-compatible
- [Chat](docs/guide.md#chat) — one assistant reply, including temperature and max tokens
- [Stream](docs/guide.md#stream) — the same call, delivered as text chunks
- [List Models](docs/guide.md#list-models) — names the server reports
## Excluded
- Embeddings, tools, and raw generate
- Nextcloud types and story types
## Testing
Unit tests use `httptest`. No live model server is required.
`go test ./...` fails when [`docs/api.md`](docs/api.md) does not match the exported API. Regenerate it with:
```bash
UPDATE_API_DOCS=1 go test -run TestAPIDoc -count=1
```
## Related
- **Tales** — ExApp that consumes this library
- Workspace ADR `docs/adr/go-llm/0001-native-adapters.md`
- Workspace ADR `docs/adr/go-llm/0002-wire-only.md`