Skip to content

Release Notes - v0.2.5

Choose a tag to compare

@zhixiangxue zhixiangxue released this 09 Jan 06:30
· 74 commits to main since this release

Release Notes - v0.2.5

Release Date: 2025-01-09

New Features

Configurable Tool Executor

Added support for configurable tool execution modes to handle different workload types:

  • Three execution modes:

    • ASYNCIO (default): Best for IO-bound tasks, uses asyncio's thread pool
    • THREAD: Uses ThreadPoolExecutor for IO-bound sync functions
    • PROCESS: Uses ProcessPoolExecutor for CPU-bound tasks, bypasses Python GIL
  • Three configuration methods:

    • Initialize with tool_executor parameter
    • Switch anytime with set_tool_executor() method
    • Override for single call via asend(tool_executor=...)
  • Automatic resource management: Thread and process pools are properly cleaned up

Example:

import chak

# For CPU-intensive tools
conv = chak.Conversation(
    "openai/gpt-4o",
    tools=[heavy_compute],
    tool_executor=chak.ToolExecutor.PROCESS
)

# Switch execution mode
conv.set_tool_executor(chak.ToolExecutor.ASYNCIO)

# Override for single call
await conv.asend("Run task", tool_executor=chak.ToolExecutor.PROCESS)

Documentation

  • Added execution mode selection guide in README
  • Added comparison table for different workload types
  • Updated examples with new tool executor demo

Technical Details

  • Added ToolExecutor enum with three modes
  • Modified Conversation to support executor configuration
  • Updated ToolManager to pass executor to tool calls
  • Enhanced NativeFunctionTool.call() to execute with specified executor
  • Added proper cleanup in Conversation.close()

Breaking Changes

None. This release is fully backward compatible.


Upgrade: pip install --upgrade chakpy