Skip to content

Commit

Permalink
feat(agents-api): Add migration for adding description to the tools r…
Browse files Browse the repository at this point in the history
…elation

Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Oct 3, 2024
1 parent fb32a44 commit a7e3749
Showing 1 changed file with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#/usr/bin/env python3

MIGRATION_ID = "add_description_to_tools"
CREATED_AT = 1727922523.283493


add_description_to_tools = dict(
up="""
?[agent_id, tool_id, type, name, description, spec, updated_at, created_at] := *tools {
agent_id, tool_id, type, name, spec, updated_at, created_at
}, description = null
:replace tools {
agent_id: Uuid,
tool_id: Uuid,
=>
type: String,
name: String,
description: String?,
spec: Json,
updated_at: Float default now(),
created_at: Float default now(),
}
""",
down="""
?[agent_id, tool_id, type, name, spec, updated_at, created_at] := *tools {
agent_id, tool_id, type, name, spec, updated_at, created_at
}
:replace tools {
agent_id: Uuid,
tool_id: Uuid,
=>
type: String,
name: String,
spec: Json,
updated_at: Float default now(),
created_at: Float default now(),
}
""",
)


queries_to_run = [
add_description_to_tools,
]


def run(client, *queries):
joiner = "}\n\n{"

query = joiner.join(queries)
query = f"{{\n{query}\n}}"
client.run(query)


def up(client):
run(client, *[q["up"] for q in queries_to_run])


def down(client):
run(client, *[q["down"] for q in reversed(queries_to_run)])

0 comments on commit a7e3749

Please sign in to comment.