NVIDIA / NeMo-Guardrails

NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems.
Other
3.98k stars 365 forks source link

Starting actions assigned to variables #441

Open Isaac-AC opened 5 months ago

Isaac-AC commented 5 months ago

Hi, thanks for the amazing framework!

I am trying to execute an action from a variable, something like this, but i don't know the syntax or if that is possible. in theory $tools has a str with the name of the action

define flow select tool $tools = execute select_tool $validation = execute $tools

which tool the user require? : images_generation bot: Action '$tools' not found. <class 'str'>

drazvan commented 5 months ago

Hi @Isaac-AC! Unfortunately, executing actions by name is not supported. The only work around I can think of is to also define a flow for each tool and call the flow by name. This is possible, for example: https://github.com/NVIDIA/NeMo-Guardrails/blob/develop/nemoguardrails/rails/llm/llm_flows.co#L58. But this would only work if you have a small, pre-determined number of tools.