What's New
Release notes and highlights. See full changelog for details.
0.3.1 (2025-09-06)
Tool payload normalization
- Central helper for dataclasses and containers; providers use consistent JSON serialization.
Anthropic structured outputs
- Provider‑native guidance with precise nested key hints; minimal object prefill ("{") only.
- Remove unsupported
response_format; single strict finalize turn remains.
Gemini fixes
- Suppress non‑text warnings by reading
candidates.content.parts. - Ensure
FunctionResponse.responseis a dict (wrap scalars as{ "result": ... }).
- Suppress non‑text warnings by reading
Ollama
- Native path unchanged (strict
formatenforcement). - OpenAI‑chat path adds strict nested‑keys finalize hints where schema cannot be enforced.
- Native path unchanged (strict
Tests & imports
- Add unit tests for ask context, env overrides, finalize predicate.
- Move non‑optional imports to module scope; keep provider SDK imports lazy.
0.3.0 (2025-09-02)
Finalize centralization
- One canonical rule in
should_finalize_structured_outputhandles strings (including wrapped primitives) vs. non-strings. - Providers defer to it; string outputs finalize only when empty.
- One canonical rule in
Shared helpers
build_tools_commonfor uniform tool-schema building across providers.ensure_object_schemawraps primitives into{ "value": ... }consistently.
Config extras (generic-first)
- Use
tool_choice,allowed_tools,disable_parallel_tool_use,ollama_api; provider-prefixed fallbacks supported.
- Use
Provider parity & cleanup
- Client getters standardized (
_get_sync_client/_get_async_client). - Streaming: robust close/aclose for Gemini and Ollama streams; OpenAI/Anthropic already use context managers.
- Anthropic: skip JSON prefill after tool errors so plain messages surface.
- Ollama (headline): dual API support — native
/api/chatand OpenAI‑compatible Chat Completions (openai_chat). Auto‑routesollama:*gpt-oss*toopenai_chatunless overridden viaextra["ollama_api"]. Tools supported in both paths; native path supports strictformat={JSON Schema}for structured outputs. - Ollama: remove broad exception wrapping in
complete(); runtime errors propagate consistently.
- Client getters standardized (
Docs & tests
- Configuration extras presented as tables; production guide clarifies error surfaces and retries.
- Tests updated for new getters; added unit tests for base helpers.
0.2.2 (2025-08-29)
- Shared loop & Gemini alignment
- Centralized tool loop and provider state (
BaseLoopState) migrated across OpenAI/Anthropic/Gemini. - Gemini now always uses the shared loop; finalize parity with Anthropic/OpenAI preserved.
- Centralized tool loop and provider state (
- Streaming API:
ask.stream_async()returns anAsyncIterable[str]directly (no await at call site). - Structured outputs: providers finalize only when
auto_finalize_missing_output=True(default on). - OpenAI: reasoning models ignore temperature; Alloy drops it and logs a debug line.
- Fake backend: stricter schema fill (nested required properties) to mirror provider strict mode.
0.2.0 (2025-08-26)
Cross‑provider streaming policy
- Unified on text‑only streaming. Commands with tools or non‑string outputs do not stream (guarded in code and docs).
- Examples and Getting Started updated to call this out explicitly.
OpenAI
- Responses API migration with shared request builder and centralized function‑calling loop via
_LoopState. - Safer output assembly; always threads
previous_response_id. - One follow‑up finalize (no tools) when a structured result is missing; raises
ToolLoopLimitExceededwhen the turn cap is exceeded. - Async parallel tool execution using
asyncio.to_thread.
- Responses API migration with shared request builder and centralized function‑calling loop via
Gemini
- Backend refactor for non‑streaming flows: capped tool loop and strict finalize pass with the provided schema.
- Text‑only streaming preserved; tools/structured outputs not supported in stream.
Anthropic
- Parity with OpenAI/Gemini for tools: robust loop with parallel tool results aggregated into a single user message.
- Respects configured
tool_choice(defaults to{type:"auto"}); supportsanthropic_disable_parallel_tool_use. - Structured outputs: prefill only for non‑string primitives and object schemas; no prefill for strings; one JSON‑only finalization step after tools when needed.
- Text‑only streaming supported; tools/structured outputs not supported in stream.
Commands & typing
- Enforce command prompt functions are annotated
-> str; the decorator controls the output type. - Clearer parse errors and refined type stubs for default returns and async variants.
- Enforce command prompt functions are annotated
Safety & configuration
- Default
max_tool_turns=10(override viaconfigureorALLOY_MAX_TOOL_TURNS).
- Default
Tests & docs
- New Anthropic integration tests: structured float/object, text‑only streaming, and parallel tool calls.
- Docs improvements: stability page, streaming policy, configuration defaults; theme & brand refinements.
0.1.4 (2025-08-14)
- Typing defaults: omit
output→str(async →Awaitable[str]); refined stubs and preserved ParamSpec;ask.stream_asynctyped. - DBC:
ToolErrormessages surface back to the model (OpenAI/Anthropic) for early corrective feedback; unit + integration tests; docs + examples. - Docs: Typing page, Equivalence Guide, Tool Recipes, patterns examples; standardized imports and decorator style.
- Tooling: pre-commit enforcement for imports and decorator style in code + docs.