-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Pydantic AI integration support #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add pydantic-ai>=0.1.0 to project dependencies to enable integration with Pydantic AI framework
Add to_pydantic_ai() method to StackOneTool class for converting tools to Pydantic AI format Add to_pydantic_ai() method to Tools class for batch conversion Implements async wrapper for tool execution compatible with Pydantic AI framework
Add comprehensive example showing how to use StackOne tools with Pydantic AI agents Include tests for tool conversion and integration functionality Demonstrate async agent usage with HRIS tools
Add Pydantic AI to supported frameworks list Include inline examples for Pydantic AI, LangChain, and OpenAI integrations Remove outdated documentation links and streamline AI framework integration section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
1 issue found across 3 files • Review in cubic
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.
|
|
||
| return StackOneLangChainTool() | ||
|
|
||
| def to_pydantic_ai(self) -> PydanticAITool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern of adding a specific to_framework() method for each new AI framework integration directly to the core StackOneTool class violates the Open/Closed Principle (OCP). This design choice tightly couples the core tool definition to external, third-party frameworks. As the number of supported integrations grows, this approach will require continuous modification of the core StackOneTool class, increasing maintenance burden and the risk of regressions. A more scalable and architecturally sound approach would involve an Adapter or Plugin pattern, where new framework converters can be added without modifying the core tool's source code, adhering to OCP and reducing coupling.
Prompt for AI agents
Address the following comment on stackone_ai/models.py at line 401:
<comment>The pattern of adding a specific `to_framework()` method for each new AI framework integration directly to the core `StackOneTool` class violates the Open/Closed Principle (OCP). This design choice tightly couples the core tool definition to external, third-party frameworks. As the number of supported integrations grows, this approach will require continuous modification of the core `StackOneTool` class, increasing maintenance burden and the risk of regressions. A more scalable and architecturally sound approach would involve an Adapter or Plugin pattern, where new framework converters can be added without modifying the core tool's source code, adhering to OCP and reducing coupling.</comment>
<file context>
@@ -397,6 +398,24 @@ async def _arun(self, **kwargs: Any) -> Any:
return StackOneLangChainTool()
+ def to_pydantic_ai(self) -> PydanticAITool:
+ """Convert this tool to Pydantic AI format
+
</file context>
|
readme should be midified based on #20 |
Summary
Changes
Core Implementation
Examples & Tests
Documentation
Test Plan
Summary by cubic
Added Pydantic AI integration, allowing StackOne tools to be used with Pydantic AI agents and workflows.