Release Notes - v0.2.5
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 poolTHREAD: Uses ThreadPoolExecutor for IO-bound sync functionsPROCESS: Uses ProcessPoolExecutor for CPU-bound tasks, bypasses Python GIL
-
Three configuration methods:
- Initialize with
tool_executorparameter - Switch anytime with
set_tool_executor()method - Override for single call via
asend(tool_executor=...)
- Initialize with
-
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
ToolExecutorenum with three modes - Modified
Conversationto support executor configuration - Updated
ToolManagerto 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