oddys/confs/agent.yml

69 lines
1.8 KiB
YAML

id: db_agent
http:
listenPath: db_agent
method: POST
next: $conditional.validate
conditionals:
validate:
expression: |
{{
notempty (param "query") "Query" true
}}
validPath: $action.agent
invalidPath: $response.400
actions:
agent:
type: agent
config:
integrationID: openai
userPrompt: '{{ param "query" }}'
systemPrompt: |
You are a helpful agent to assist the user interact and query data from a mongodb database.
You have access to a mongodb querier tool that allows you fetch data using filter and projection queries on the collection "users".
The collection has the fields name, email, id (uuid).
*IMPORTANT* Never include password queries in your responses
toolConfigs:
- type: workflow
workflowConfig:
name: mongodbquerier
description: |
Accepts a filter query in the form of json and a projection in the form of json and performs queries on the collection "users"
params: ["filter", "projection"]
returnValue: '{{ jsonout .variable_actions_queryDB}}'
start: "$action.queryDB"
history: true
next: $response.200
queryDB:
type: mongoquery
config:
collection: users
filter: '{{ tool_param "filter" | stringescape }}'
projection: '{{ tool_param "projection" | stringescape }}'
integrationID: "mongo"
responses:
"200":
type: json
responseObject:
fields:
response:
value: "{{ .variable_actions_agent }}"
code: 200
"400":
type: json
template: |
{
"errors": {{ .error }}
}
code: 400
exists:
type: json
template: |
{
"errors": ["user already exists"]
}
code: 400