Alloy v0.3.1 — Provider‑native structured outputs; Gemini/Ollama fixes; coverage
Release date: 2025-09-06
Highlights
- Anthropic structured outputs (provider‑native): precise nested‑key guidance derived from your JSON Schema; minimal object prefill ("{") only; no unsupported
response_formatusage. Single strict finalize turn remains when a typed result is missing. - Gemini tool responses: suppress SDK non‑text warnings by reading
candidates.content.parts; ensureFunctionResponse.responseis a dict (wrap scalars as{ "result": ... }). - Ollama:
- Native path unchanged: strict JSON Schema enforcement via
format. - OpenAI‑compat path adds strict nested‑keys finalize hints where schema cannot be enforced.
- Native path unchanged: strict JSON Schema enforcement via
- Tool payload normalization: centralized helper normalizes dataclasses and containers to JSON‑safe structures; providers use consistent serialization.
- Finalize predicate: detects missing required keys recursively for object schemas to reduce parse failures.
Scope clarifications (structured outputs)
- OpenAI Chat Completions supports structured outputs via
response_format={"type":"json_schema"}on supported models (e.g.,gpt‑4o‑2024‑08‑06). text.formatis a Responses API concept (not part of Chat Completions).- Ollama’s OpenAI‑compat
/v1/chat/completionsdoes not implement OpenAI’sresponse_formatstructured outputs; reports show it is ignored. - Ollama’s native
/api/chatsupports schema enforcement via its ownformatfield (JSON / JSON Schema).
Tests & coverage
- Added unit tests for ask context (sync/async), env overrides, and finalize predicate presence checks.
- Restored async ask context test.
- Non‑integration coverage ≥ 80%.
Internal
- Imports: moved non‑optional imports to module scope across backends; kept provider SDK imports lazy/guarded.
No breaking API changes.