Replies: 1 comment 1 reply
-
Hi @grupocopa! The value extraction is highly dependent on the capabilities of the underlying LLM. I've tweaked what you shared to a working version: models:
- type: main
engine: openai
model: gpt-3.5-turbo-instruct
(note that you're better off including actual values when defining the user intents, rather than from nemoguardrails.actions import action
@action()
async def get_medicine_price(remedio, dosagem):
assert remedio.lower() == "dipirona"
# Fake data
data = {
"nomeComercial": "Dipirona",
"formasFarmaceuticas": {"1g": {"preco": 6.99}, "500mg": {"preco": 3.49}},
"Laboratorio": "Sanofi-Aventis",
}
return data["formasFarmaceuticas"][dosagem]
I hope this sets you on the right path. We'll share examples of such flows with Colang 2.0 very soon, which is a better fit for this. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone!
I'm facing an issue with entity extraction and custom function execution using NVIDIA's NeMo Guardrails framework. I'm trying to capture the values of medicines and dosages from user input and then use that information to make a request to an API that returns the price of the medicine.
Despite several attempts with different approaches, I haven't been able to get NeMo to correctly capture the entities from the user's input and pass these values to the Python function.
Context and Goal:
My goal is to create a flow where the user can request the price of a specific medicine with a specific dosage. The idea is that the system captures these values, executes a Python function to retrieve the medicine's price, and then returns this information to the user.
Code Structure
My actions.py inside my config folder projects is:
Important:
When I put the raw medication here on {remedio} variable, the API is 100% functional, and it returns the data I wanted on this structure.
For example, using Dipirona at base_link = f"https://example.com/api/buscaRemedio/Dipirona"
{ "nomeComercial": "Dipirona", "formasFarmaceuticas": { "1g": { "preco": 6.99 }, "500mg": { "preco": 3.49 } }, "Laboratorio": "Sanofi-Aventis" }
3x Attempts
First Attempt - Direct Entity Capture:
Code Used on flows.co
Second Attempt - Using generate_value:
Code Used on flows.co:
Third Attempt - Using $last_user_message:
Development Environment:
Framework: NeMo Guardrails
Language: Python
System: Windows 10
API: Using httpx.AsyncClient to perform the price request
Documentation used
https://docs.nvidia.com/nemo/guardrails/user_guides/advanced/extract-user-provided-values.html
NeMo Framework - Guardrails | NVIDIA Inception training
Questions:
I appreciate any help or insights the community can provide! Thank you!
Beta Was this translation helpful? Give feedback.
All reactions