Skip to content

V0.9.1

Choose a tag to compare

@JohnRichard4096 JohnRichard4096 released this 07 Jun 07:19
· 112 commits to main since this release
e14586c

AmritaCore 0.9.1 Release Summary

This release introduces a major refactoring of the streaming and suspend/resume APIs, adds first-class support for model reasoning/thinking capabilities, enhances adapters with embeddings and extended thinking, and improves type safety with typed metadata classes.

Highlights

  • ChatObject API Refactoring – ChatObject now uses composition over inheritance for streaming functionality (io_stream attribute). All streaming and suspend/resume methods are deprecated forwarding wrappers and will be removed in v0.10.0.
  • Reasoning/Thinking Support – New ThinkingConfig class enables controlled reasoning for OpenAI o-series and Anthropic extended thinking. Reasoning content is exposed via reasoning_content and reasoning_signature fields.
  • Typed Metadata – New amrita_core.builtins.types module provides typed metadata classes for agent hooks and workflows, replacing plain dictionaries.
  • OpenAI Embeddings – OpenAIAdapter now implements call_embed() for vector retrieval workflows.
  • Anthropic Extended Thinking – Full support for Anthropic's thinking blocks, including delta streaming and signature round-tripping.

Breaking Changes & Deprecations

Deprecated Streaming Methods (v0.10.0 removal)

All streaming-related methods on ChatObject have been moved to chat.io_stream. The following methods are deprecated and emit warnings:

Old method New method
get_response_generator() io_stream.get_response_generator()
set_callback_func(func) io_stream.set_callback_func(func)
set_callback_fun_sending(func) io_stream.set_callback_fun_sending(func)
yield_response(response) io_stream.yield_response(response)
yield_response_iteration(iterator) io_stream.yield_response_iteration(iterator)
push_object(obj) io_stream.push_object(obj)
queue_closed() io_stream.queue_closed()
set_queue_done() io_stream.set_queue_done()
wait_to_suspend(*tags, timeout) io_stream.wait_to_suspend(*tags, timeout)
resume() io_stream.resume()

Migration example:

# Old (0.9.0)
async for chunk in chat.get_response_generator():
    print(chunk)

# New (0.9.1)
async for chunk in chat.io_stream.get_response_generator():
    print(chunk)

Constructor Parameter Changes

  • callback parameter removed from ChatObject. Use chat.io_stream.set_callback_func() after creation.
  • queue_size and queue_timeout parameters removed. Configure via custom io_stream if needed.

Removed Dependency

  • anyio is no longer a direct dependency (now pulled via amrita-sense).

New Features

Thinking/Reasoning Configuration

Added ThinkingConfig class to control model reasoning behavior:

from amrita_core.types import ThinkingConfig, ModelPreset

preset = ModelPreset(
    model="claude-sonnet-4-20250514",
    thinking_config=ThinkingConfig(
        thinking_type="enabled",
        thinking_effort="high",
        content_mode="by-tool",
    ),
)

Reasoning Content in Responses

  • UniResponse.reasoning_content and UniResponse.reasoning_signature
  • Message.reasoning_content and Message.reasoning_signature (only for role="assistant")

Typed Built-in Metadata

New module amrita_core.builtins.types with typed metadata payloads:

  • AgentReasoningMetadata – Pre-resolve reasoning summaries
  • AgentReasoningChunkMetadata – Streaming reasoning chunks
  • AgentToolCallMetadata – Tool call notifications
  • AgentLoopErrorMetadata – Loop detection errors
  • AgentMiddleMessageMetadata – LLM middle messages
  • HookErrorMetadata – Hook-level error responses

OpenAI Embedding API

OpenAIAdapter.call_embed() enables text embedding for vector retrieval workflows.

Anthropic Extended Thinking

Full support for Anthropic's thinking feature:

  • Processes thinking_delta and signature_delta events during streaming
  • Handles thinking blocks in non-streaming responses
  • Supports thinking parameter with budget_tokens

Agent Workflow Enhancements

  • Added WHILE loop with counter factory for tool call iteration limits
  • New suspend tags: SuspendEnum.ADVANCE_COUNTER, SuspendEnum.STRATEGY_EOF

Improvements

  • Documentation: All API references updated to reflect io_stream composition. Added ThinkingConfig documentation. Chinese translations synced.
  • ChatObject Workflow: Refactored into node-based composition with pre-rendered workflow for better performance.
  • Message Validation: Message now validates that reasoning_content only appears on assistant messages.
  • Memory Limiter: Improved token counting with proper tokenizer type handling.
  • Deprecation Warnings: Added clearer removal version indications (v0.10.0) to deprecated modules.

Bug Fixes

  • Fixed Anthropic adapter test mocks to align with latest SDK event types.
  • Corrected typo in deprecation message for reinitalize_all().
  • Fixed queue_size/queue_timeout not being forwarded correctly in some edge cases.

Upgrade Notes

  1. Update amrita-sense to >=0.3.0 (required).
  2. Replace all chat.get_response_generator() calls with chat.io_stream.get_response_generator().
  3. Replace chat.set_callback_func() with chat.io_stream.set_callback_func().
  4. Remove callback=, queue_size=, queue_timeout= from ChatObject constructor.
  5. For suspend/resume, use chat.io_stream.wait_to_suspend() and chat.io_stream.resume().

Dependency Updates

  • amrita-sense: >=0.2.1 → >=0.3.0
  • anyio: removed from direct dependencies
  • anthropic: updated to 0.105.2
  • openai: updated to 2.41.0
  • aiohttp: updated to 3.14.0
  • Various other transitive updates (see uv.lock for full list)

What's Changed

Full Changelog: 0.9.0...0.9.1