feat(client): add LLMClient abstraction with configurable reasoning inclusion #52

Merged
ph merged 1 commit from feat/issue-49-llm-client into master 2026-06-08 15:30:11 +00:00
Owner

Summary

Add an LLMClient wrapper over go-openai that centralizes all LLM API calls and supports configurable reasoning content filtering.

Closes #49.

Changes

File Change
internal/config/config.go Add IncludeReasoning bool config field (default false)
internal/client/llm_client.go NewLLMClient + ChatRequest + convertMessages()
internal/client/llm_client_test.go New — 7 unit tests
internal/client/manager.go Add LLMClient() factory method
internal/agent/agent.go Switch from *openai.Client to *LLMClient
internal/agent/compact.go Switch to LLMClient

Design

  • All LLM calls (streaming and non-streaming) now go through LLMClient
  • Reasoning content is not sent to the API by default (IncludeReasoning = false)
  • Configurable via ~/.config/gd/config.toml: [defaults] include_reasoning = true
  • Stream capture and frontend rendering of thinking parts are unaffected

Verification

  • make build
  • go test ./... -count=1 — all 8 packages pass
  • go vet
## Summary Add an `LLMClient` wrapper over `go-openai` that centralizes all LLM API calls and supports configurable reasoning content filtering. Closes #49. ## Changes | File | Change | |------|--------| | `internal/config/config.go` | Add `IncludeReasoning bool` config field (default false) | | `internal/client/llm_client.go` | **New** — `LLMClient` + `ChatRequest` + `convertMessages()` | | `internal/client/llm_client_test.go` | **New** — 7 unit tests | | `internal/client/manager.go` | Add `LLMClient()` factory method | | `internal/agent/agent.go` | Switch from `*openai.Client` to `*LLMClient` | | `internal/agent/compact.go` | Switch to `LLMClient` | ## Design - All LLM calls (streaming and non-streaming) now go through `LLMClient` - Reasoning content is **not** sent to the API by default (`IncludeReasoning = false`) - Configurable via `~/.config/gd/config.toml`: `[defaults] include_reasoning = true` - Stream capture and frontend rendering of thinking parts are unaffected ## Verification - `make build` ✅ - `go test ./... -count=1` — all 8 packages pass ✅ - `go vet` ✅
Add LLMClient wrapper over go-openai that centralizes all LLM API
calls and supports configurable reasoning content filtering.

- Add IncludeReasoning bool to config (default false)
- Add LLMClient + ChatRequest + convertMessages() in internal/client
- Add LLMClient() factory method on Manager
- Switch Agent from openai.Client to LLMClient
- Add 7 unit tests for message conversion with/without reasoning
- Remove dead code: Agent.modelID(), ModelTypeToModel()

Closes #49
ph merged commit b94cdaac57 into master 2026-06-08 15:30:11 +00:00
ph deleted branch feat/issue-49-llm-client 2026-06-08 15:30:11 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ph/agentic!52
No description provided.