v0.3.0
VRSEN/agency-swarmv0.3.0Aug 20, 2024by VRSEN
AI Summary
A major update shifting away from the `instructor` library to OpenAI's native Structured Outputs implementation. This introduces 'strict' mode, JSON schema support, and a new parsing method for Pydantic models.
Key Highlights
- Removed Instructor dependency in favor of OpenAI Structured Outputs
- Added 'strict' mode support for tools
- New `get_completion_parse` method for Pydantic models
- Verbose mode for get_completion
Breaking Changes
- The `one_call_at_a_time` parameter in `BaseTool` is now located under `ToolConfig`
- `shared_state` and `caller_agent` are now private attributes
New Features
- OpenAI native response format implementation
- Strict mode for tools
- JSON schema response format support
- get_completion_parse method
- Verbose mode for get_completion
- Improved error handling for existing threads
Full Release Notes
## New Features
* **Removed Instructor:** Agency Swarm no longer relies on the instructor. If a Pydantic model is passed, the `response_format` parameter will now use OpenAI's implementation. The tool creation process remains unchanged.
* **`strict` mode:** You can now enable "strict" mode when creating tools in both the `BaseTool` class and in your schema using `ToolFactory`. See [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) for more details.
* **`response_format: json_schema`:** The response format can now be set to `json_schema` in both the `Agent` class and completion methods.
* **`get_completion_parse`:** This new method allows you to pass a Pydantic model directly to the `response_format` method, which will then return a parsed model. If the request is refused, a `RefusalError` from `agency_swarm.util.errors` will be raised.
* **Verbose mode for `get_completion`:** By setting the `verbose` parameter to `true`, you can view intermediary messages, similar to Crew AI.
* **Improved error handling for existing threads:** The system will now automatically cancel any active runs within a thread and continue the conversation.
## Bug Fixes
* Fixed shared state initialization when testing tools separately. #165
* Improved common error handling like connection errors and rate limits in Thread.
## ⚠️ Breaking Changes in `BaseTool` Class
* The `one_call_at_a_time` parameter in `BaseTool` is now located under `ToolConfig`.
* `shared_state` and `caller_agent` are now private attributes.
```python
from agency_swarm.tools import BaseTool
class Action1(BaseTool):
input: str = Field(...)
# one_call_at_a_time = True # before
class ToolConfig:
one_call_at_a_time = True # now
strict = True # new
def run(self):
# self.shared_state.get('param') # before
self._shared_state.get('param') # now
```
**Full Changelog:** [GitHub Compare v0.2.6...v0.2.7](https://github.com/VRSEN/agency-swarm/compare/v0.2.6...v0.2.7)