Skip to content

v0.3.1

Latest

Choose a tag to compare

@lydakis lydakis released this 06 Sep 21:52
· 54 commits to main since this release

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_format usage. Single strict finalize turn remains when a typed result is missing.
  • Gemini tool responses: suppress SDK non‑text warnings by reading candidates.content.parts; ensure FunctionResponse.response is 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.
  • 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.format is a Responses API concept (not part of Chat Completions).
  • Ollama’s OpenAI‑compat /v1/chat/completions does not implement OpenAI’s response_format structured outputs; reports show it is ignored.
  • Ollama’s native /api/chat supports schema enforcement via its own format field (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.