This should use a call_llm action under the hood. We already have expressions for prompt and slice of categories to make this easy. Let's go with an example.. after saving with example categories of "Flights" and "Hotels", the user should be left with a node definition that looks something like this:
{
"uuid": "145eb3d3-b841-4e66-abac-297ae525c7ad",
"actions": [
{
"type": "call_llm",
"uuid": "3cd8f2db-8429-462e-ab93-8041dd23abf1",
"llm": {
"uuid": "1c06c884-39dd-4ce4-ad9f-9a01cbe6c000",
"name": "Claude"
},
"instructions": "@(prompt(\"categorize\", slice(node.categories, 0, -2)))",
"input": "@input",
"output_local": "_llm_output"
}
],
"router": {
"type": "switch",
"categories": [
{
"uuid": "6103fa71-6ca9-4300-aec6-929f50fa1ae0",
"name": "Flights",
"exit_uuid": "33712037-9861-4d61-9dcb-60d7fffef96a"
},
{
"uuid": "bcb18434-1932-4a38-a4cd-a2c4a70b8e9a",
"name": "Hotels",
"exit_uuid": "fdd988ba-34c1-45a8-8413-e89b0a36001e"
},
{
"uuid": "a766ac1a-766f-4ce5-be4c-a24061bfdec0",
"name": "Other",
"exit_uuid": "bbcb0d26-a8c4-48f7-9d39-eeb202d09876"
},
{
"uuid": "e86a60b9-6e8e-4150-9ab9-19e6eb7003d9",
"name": "Failure",
"exit_uuid": "959d6e4c-658a-49fc-a80d-5ed7df5af640"
}
],
"default_category_uuid": "a766ac1a-766f-4ce5-be4c-a24061bfdec0",
"operand": "@locals._llm_output",
"result_name": "Intent",
"cases": [
{
"uuid": "d2f852ec-7b4e-457f-ae7f-f8b243c49ff5",
"type": "has_only_text",
"arguments": [
"Flights"
],
"category_uuid": "6103fa71-6ca9-4300-aec6-929f50fa1ae0"
},
{
"uuid": "692926ea-09d6-4942-bd38-d266ec8d3716",
"type": "has_only_text",
"arguments": [
"Hotels"
],
"category_uuid": "bcb18434-1932-4a38-a4cd-a2c4a70b8e9a"
},
{
"uuid": "73bfb9dc-9bbb-4928-92fd-d8957edf4a92",
"type": "has_only_text",
"arguments": [
"<ERROR>"
],
"category_uuid": "e86a60b9-6e8e-4150-9ab9-19e6eb7003d9"
}
]
},
"exits": [
{
"uuid": "33712037-9861-4d61-9dcb-60d7fffef96a"
},
{
"uuid": "fdd988ba-34c1-45a8-8413-e89b0a36001e"
},
{
"uuid": "bbcb0d26-a8c4-48f7-9d39-eeb202d09876"
},
{
"uuid": "959d6e4c-658a-49fc-a80d-5ed7df5af640"
}
]
}
This should be accomplished using the action and node configs for the editor. If something is missing there to make this feature work, then it should be adapted accordingly.
We need to create a new kind of node in the flow editor that does the following:
Allows the user to specify:
@inputThis should use a call_llm action under the hood. We already have expressions for
promptandsliceof categories to make this easy. Let's go with an example.. after saving with example categories of "Flights" and "Hotels", the user should be left with a node definition that looks something like this:This should be accomplished using the action and node configs for the editor. If something is missing there to make this feature work, then it should be adapted accordingly.