Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c4e0081d8 | |||
| 15fb8e19a8 |
@@ -7,19 +7,15 @@ on:
|
|||||||
branches: ["*"]
|
branches: ["*"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
root-module:
|
||||||
name: Build, Test & Lint
|
name: Root Module
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: v2
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: v2/go.mod
|
go-version: "1.24"
|
||||||
cache-dependency-path: v2/go.sum
|
|
||||||
|
|
||||||
- name: Download dependencies
|
- name: Download dependencies
|
||||||
run: go mod download
|
run: go mod download
|
||||||
@@ -33,7 +29,48 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
run: go test -race -count=1 ./...
|
run: go test -race -count=1 ./...
|
||||||
|
|
||||||
- name: Check v2 module tidiness
|
v2-module:
|
||||||
|
name: V2 Module
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: v2
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.24"
|
||||||
|
|
||||||
|
- name: Download dependencies
|
||||||
|
run: go mod download
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: go build ./...
|
||||||
|
|
||||||
|
- name: Vet
|
||||||
|
run: go vet ./...
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: go test -race -count=1 ./...
|
||||||
|
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.24"
|
||||||
|
|
||||||
|
- name: Check root module tidiness
|
||||||
run: |
|
run: |
|
||||||
go mod tidy
|
go mod tidy
|
||||||
git diff --exit-code go.mod go.sum
|
git diff --exit-code go.mod go.sum
|
||||||
|
|
||||||
|
- name: Check v2 module tidiness
|
||||||
|
run: |
|
||||||
|
cd v2
|
||||||
|
go mod tidy
|
||||||
|
git diff --exit-code go.mod go.sum
|
||||||
|
|||||||
@@ -32,3 +32,13 @@
|
|||||||
6. Streaming via pull-based `StreamReader.Next()`
|
6. Streaming via pull-based `StreamReader.Next()`
|
||||||
7. Middleware for logging, retry, timeout, usage tracking
|
7. Middleware for logging, retry, timeout, usage tracking
|
||||||
8. Ollama uses the native `/api/chat` API rather than the OpenAI-compat `/v1` endpoint. Native API supports `think: false` for thinking-capable models, has more reliable tool calling, and is approximately 15-20% lower latency. Both local and cloud share the same provider; only the apiKey/baseURL differ. `llm.Ollama()` targets `http://localhost:11434` with no Authorization header; `llm.OllamaCloud(key)` targets `https://ollama.com` with `Authorization: Bearer <key>`.
|
8. Ollama uses the native `/api/chat` API rather than the OpenAI-compat `/v1` endpoint. Native API supports `think: false` for thinking-capable models, has more reliable tool calling, and is approximately 15-20% lower latency. Both local and cloud share the same provider; only the apiKey/baseURL differ. `llm.Ollama()` targets `http://localhost:11434` with no Authorization header; `llm.OllamaCloud(key)` targets `https://ollama.com` with `Authorization: Bearer <key>`.
|
||||||
|
|
||||||
|
### DD#9 — foreman integration via thin Foreman() constructor (2026-05-23)
|
||||||
|
**Context:** foreman is a private queued Ollama endpoint. It speaks native Ollama
|
||||||
|
on the wire, so no new provider is needed.
|
||||||
|
**Decision:** `llm.Foreman(baseURL, apiKey)` delegates to `ollamaProvider.New()`.
|
||||||
|
baseURL is positional and required (no sensible default for a private daemon).
|
||||||
|
apiKey can be empty for network-trusted deployments.
|
||||||
|
**Consequence:** Zero new code paths. Streaming, tool use, and think work through
|
||||||
|
the existing native ollama provider. A dedicated foreman provider (Level 2) is
|
||||||
|
deferred unless async /jobs or webhook integration is needed at the llm layer.
|
||||||
|
|||||||
@@ -137,3 +137,27 @@ func OllamaCloud(apiKey string, opts ...ClientOption) *Client {
|
|||||||
}
|
}
|
||||||
return NewClient(ollamaProvider.New(apiKey, baseURL))
|
return NewClient(ollamaProvider.New(apiKey, baseURL))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Foreman creates a client targeting a foreman daemon (a private, authenticated
|
||||||
|
// Ollama endpoint with queuing and observability). baseURL is required
|
||||||
|
// (e.g. "http://foreman:8080"). apiKey is the optional static bearer token; pass
|
||||||
|
// "" for an unauthenticated (network-trusted) deployment.
|
||||||
|
//
|
||||||
|
// foreman speaks native Ollama on the wire, so this delegates to the ollama
|
||||||
|
// provider unchanged — streaming, tool use, and think all work transparently.
|
||||||
|
//
|
||||||
|
// See: https://gitea.stevedudenhoeffer.com/steve/foreman
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// model := llm.Foreman("http://foreman.orgrimmar:8080", token).Model("qwen3:30b")
|
||||||
|
func Foreman(baseURL, apiKey string, opts ...ClientOption) *Client {
|
||||||
|
cfg := &clientConfig{}
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(cfg)
|
||||||
|
}
|
||||||
|
if cfg.baseURL != "" {
|
||||||
|
baseURL = cfg.baseURL
|
||||||
|
}
|
||||||
|
return NewClient(ollamaProvider.New(apiKey, baseURL))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user