Skip to content
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] refactor tools metadata schema #320

Merged
merged 3 commits into from
Jun 28, 2024
Merged

Conversation

scott-cohere
Copy link
Contributor

@scott-cohere scott-cohere commented Jun 28, 2024

  1. change artifact schema to be stored as json, would look like this in payload
[
    {
        "user_id": "user-id",
        "organization_id": null,
        "id": "d972bab4-7877-47f1-892b-2c7ee34c32f3",
        "created_at": "2024-06-28T17:41:40.562919",
        "updated_at": "2024-06-28T17:41:40.562919",
        "version": 1,
        "name": "scott's assistant 3",
        "description": "",
        "preamble": "answer everything as a pirate",
        "temperature": 0.0,
        "tools": [
            "web_search"
        ],
        "tools_metadata": [
            {
                "user_id": "user-id",
                "organization_id": null,
                "id": "8234886e-280e-48eb-906b-7dedc7280a1d",
                "tool_name": "ToolName.Google_Drive",
                "artifacts": [
                    {
                        "id": "23123",
                        "name": "readme.md",
                        "type": "file"
                    },
                    {
                        "id": "123123",
                        "name": "readme",
                        "type": "folder"
                    }
                ]
            }
        ],
        "model": "command-r",
        "deployment": "Cohere Platform"
    }
]
  1. Also added the tools metadata to GET agents

AI Description

This PR makes changes to the agent_tool_metadata table.

  • The type column is dropped.
  • The artifacts column is dropped and a new column with the same name is added, changing the data type from ARRAY(TEXT) to ARRAY(JSONB).
  • The unique constraint _user_agent_tool_name_type_uc is dropped and a new one, _user_agent_tool_name_uc, is created without the type column.

The changes are also reflected in the AgentToolMetadata model and related test files.

  • The type attribute is removed from the AgentToolMetadata model and related test files.
  • The artifacts attribute is updated to a list of dictionaries in the AgentToolMetadata model and related test files.
  • The Agent model now includes a tools_metadata attribute, which is a list of AgentToolMetadata.
  • The AgentToolMetadata model is imported in the agent.py file.
  • The generate:client script in package.json now uses 0.0.0.0 as the IP address instead of localhost.
  • The AgentToolMetadata type in Agent.ts now includes an import statement and the tools_metadata attribute is added to the Agent type.
  • The type attribute is removed from the AgentToolMetadata type in AgentToolMetadata.ts, and the artifacts attribute is updated to an array of records.
  • The type attribute is removed from the CreateAgentToolMetadata type in CreateAgentToolMetadata.ts, and the artifacts attribute is updated to an array of records.
  • The type attribute is made optional in the UpdateAgentToolMetadata type in UpdateAgentToolMetadata.ts, and the artifacts attribute is updated to accept null values.

@scott-cohere scott-cohere merged commit f6cc8f4 into main Jun 28, 2024
2 checks passed
@scott-cohere scott-cohere deleted the scott/tools-table-main-2 branch June 28, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants