Commit graph

3 commits

Author SHA1 Message Date
2f6f5fab1c feat(llm): add multimodal ContentPart/Parts + per-provider serialization
Message gains an optional Parts []ContentPart alongside the existing
plain-text Content, so a turn can carry text plus image/video
attachments. Content stays the single source of truth for every
existing text-only caller (sidebar.go, memory_tools.go, etc. are
untouched); Parts only matters to a provider client when non-empty.

openai and llamacpp (both OpenAI-compatible) serialize Parts into the
standard text/image_url content-array shape; llamacpp additionally
passes video through as a best-effort video_url part, since llama.cpp
itself has no video support but the whole point of this client is the
user's own OpenAI-compatible server sitting in front of a
video-capable model — the server decides whether it understands it,
not this client. anthropic converts image parts to its base64 image
content block, and rejects a video part outright with a clear error:
the Messages API has no video block type at all, so sending one would
just produce a confusing 400 instead.

ProviderCapabilities gains SupportsVideo, true only for llamacpp.
2026-07-16 22:23:54 -07:00
e6830161bc fix(llamacpp,anthropic): SSE headroom, no-choices guard, real context window
- llamacpp: 4MB SSE scanner buffer (the 64KB bufio.Scanner default killed
  streams whose single line exceeded it, e.g. a write tool call carrying a
  whole file) and an empty-choices guard in toResponse instead of a panic;
  request payload now uses bytes.NewReader (drops a full string copy).
- anthropic: Capabilities() reported a 1M-token context window for any
  non-haiku model. Callers use that number to decide when to compact, so
  compaction would have fired far too late and requests overflowed the
  real window. Default is now the standard 200k, configurable via
  Config.ContextWindow for extended-window models/plans.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 16:14:15 -07:00
a2de4eb812 feat(llm): add anthropic provider client, expand llama.cpp sampling config
- pkg/llm/providers/anthropic: new client implementation (was previously
  imported by rony-harness but never committed here, so a fresh clone
  wouldn't build)
- pkg/llm/providers/llamacpp: Config/Client gain the full local-model
  sampling surface (max_tokens, context_window, top_k/top_p/min_p,
  presence/repetition penalty, max_thinking_tokens) to match the
  llamacpp-local* entries added to configs/ai_providers.yaml

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-08 23:33:20 -07:00