-
Notifications
You must be signed in to change notification settings - Fork 381
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
backend: Tool config major refactoring #822
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #822 +/- ##
==========================================
+ Coverage 79.14% 79.19% +0.04%
==========================================
Files 250 250
Lines 10675 10723 +48
==========================================
+ Hits 8449 8492 +43
- Misses 2226 2231 +5 ☔ View full report in Codecov by Sentry. |
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.
Looks good to me, there is just one small thing to change.
Big tool refactor that removes a lot of friction/steps when creating or modifying a tool.
Notably:
Tool
enumTool.Google_Drive.value.ID
for exampleAI Description
This PR introduces a new
Tool
class and aToolDefinition
class, replacing the previousToolName
andManagedTool
classes. TheTool
class is an enum that maps to the tool's main implementation class, while theToolDefinition
class provides a definition for each tool, including its name, display name, implementation, parameter definitions, and other attributes.The PR also updates the
get_available_tools
function to return a dictionary of ToolDefinition objects, and modifies various files to use the newTool
andToolDefinition
classes instead of the oldToolName
andManagedTool
classes.ToolName
class is replaced with theTool
class, which is an enum that maps to the tool's main implementation class.ManagedTool
class is replaced with theToolDefinition
class, which provides a definition for each tool, including its name, display name, implementation, parameter definitions, and other attributes.get_available_tools
function is updated to return a dictionary of ToolDefinition objects.Tool
andToolDefinition
classes instead of the oldToolName
andManagedTool
classes.src/backend/config/configuration.template.yaml
file is updated to remove the enabled_tools list and replace it with a dictionary of tool definitions.src/backend/config/settings.py
file is updated to remove the enabled_tools list and replace it with a dictionary of tool definitions.src/backend/config/tools.py
file is updated to remove the ToolName class and replace it with the Tool class, and to remove the ManagedTool class and replace it with the ToolDefinition class.src/backend/main.py
file is updated to import the logging module and set the log level for the pydantic module to ERROR.src/backend/pytest.ini
file is updated to add a filterwarnings line to ignore UserWarnings from thepydantic
module.src/backend/routers/auth.py
file is updated to use the newTool
andToolDefinition
classes instead of the oldToolName
andManagedTool
classes.src/backend/routers/organization.py
file is updated to use the newTool
andToolDefinition
classes instead of the oldToolName
andManagedTool
classes.src/backend/routers/tool.py
file is updated to use the newTool
andToolDefinition
classes instead of the oldToolName
andManagedTool
classes.src/backend/schemas/tool.py
file is updated to remove the Category class and replace it with the ToolCategory class, and to remove the ManagedTool class and replace it with the ToolDefinition class.src/backend/services/auth/strategies/base.py
file is updated to add a @classmethod decorator to the _post_init_check method.src/backend/services/chat.py
file is updated to use the newTool
andToolDefinition
classes instead of the oldToolName
andManagedTool
classes.src/backend/services/file.py
file is updated to use the newTool
class instead of the oldToolName
class.src/backend/services/request_validators.py
file is updated to use the newTool
andToolDefinition
classes instead of the oldToolName
andManagedTool
classes.src/backend/tests/integration/routers/test_agent.py
file is updated to use the newTool
class instead of the oldToolName
class.src/backend/tests/unit/chat/test_tool_calls.py
file is updated to use the newTool
andToolDefinition
classes instead of the oldToolName
andManagedTool
classes.src/backend/tests/unit/config/test_tools.py
file is updated to use the newTool
class instead of the oldToolName
class.src/backend/tests/unit/configuration.yaml
file is updated to remove the enabled_tools list and replace it with a dictionary of tool definitions.src/backend/tests/unit/crud/test_agent.py
file is updated to use the newTool
class instead of the oldToolName
class.src/backend/tests/unit/crud/test_agent_tool_metadata.py
file is updated to use the newTool
class instead of the oldToolName
class.src/backend/tests/unit/crud/test_tool_auth.py
file is updated to use the newTool
class instead of the oldToolName
class.src/backend/tests/unit/factories/agent.py
file is updated to use the newTool
class instead of the oldToolName
class.src/backend/tests/unit/factories/agent_tool_metadata.py
file is updated to use the newTool
class instead of the oldToolName
class.