Skip to content

Commit

Permalink
feat: Updated agents-api/agents_api/models/agent/c
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Apr 13, 2024
1 parent 01f5bad commit f6b5b6e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions agents-api/agents_api/models/agent/create_agent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
This module contains the functionality for creating agents in the CozoDB database.
It includes functions to construct and execute datalog queries for inserting new agent records.
"""

from uuid import UUID

import pandas as pd
Expand All @@ -7,6 +12,23 @@
from ...common.utils.cozo import cozo_process_mutate_data


"""
Constructs and executes a datalog query to create a new agent in the database.
Parameters:
- agent_id (UUID): The unique identifier for the agent.
- developer_id (UUID): The unique identifier for the developer creating the agent.
- name (str): The name of the agent.
- about (str): A description of the agent.
- instructions (list[str], optional): A list of instructions for using the agent. Defaults to an empty list.
- model (str, optional): The model identifier for the agent. Defaults to "julep-ai/samantha-1-turbo".
- metadata (dict, optional): A dictionary of metadata for the agent. Defaults to an empty dict.
- default_settings (dict, optional): A dictionary of default settings for the agent. Defaults to an empty dict.
- client (CozoClient, optional): The CozoDB client instance to use for the query. Defaults to a preconfigured client instance.
Returns:
pd.DataFrame: A DataFrame containing the results of the query execution.
"""
def create_agent_query(
agent_id: UUID,
developer_id: UUID,
Expand All @@ -28,6 +50,7 @@ def create_agent_query(
)

# Create default agent settings
# Construct a query to insert default settings for the new agent
default_settings_query = f"""
?[{settings_cols}] <- $settings_vals
Expand All @@ -36,6 +59,7 @@ def create_agent_query(
}}
"""
# create the agent
# Construct a query to insert the new agent record into the agents table
agent_query = """
?[agent_id, developer_id, model, name, about, metadata, instructions] <- [
[$agent_id, $developer_id, $model, $name, $about, $metadata, $instructions]
Expand Down

0 comments on commit f6b5b6e

Please sign in to comment.