NVIDIA / NeMo-Guardrails

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

Issue in appending Coversational History #456

Closed visheshgitrepo closed 3 months ago

visheshgitrepo commented 7 months ago

Hi @drazvan

Im facing error in appending historical message using get_history_cache_key(). I tried adding colang_version : "2.x" in config.yml. It fails colangparsingerror for blocked_terms.co, So I tried removing and checking with version 1.0, its unable to fetch the keys stored.

Can you give me the steps exactly need to be performed based on latest version of Nemo Guardrail for including historical chats in conversations. And also if possible sample text or code.

Everytime I get different issue.. few of them are.. AssertionError: ***StartUtteranceBotAction events need to provide 'script' of type 'str', etc.

drazvan commented 7 months ago

@visheshgitrepo: this is the fix for the error you mentioned: https://github.com/NVIDIA/NeMo-Guardrails/pull/454. We'll publish a patch release (0.8.3) this week. Until then, you can try to use the develop branch.

visheshgitrepo commented 7 months ago

Hi @drazvan,

I still see issue with this. Please check below code and error and let me know whats wrong with this. im using develop branch

Code:

new_message=[ {'role': 'context', 'content': {'relevant_chunks': "In order for the Filing by Internet (online filing) to work given........................" } }, {"role": "user", "content": "Im getting proxy error. Please help me resolving it." }, {"role": "user", "content": "Why my account is blocked" }, { "role":"assistant", "content":"I'm sorry, I don't have access to account information. Please reach out to the IT department or your supervisor for assistance with your account issue." } ] response = rails.generate(messages=new_message)

cache_key = get_history_cache_key(message_test)

state = rails.events_history_cache[cache_key]

print(response["content"])

Error:

AssertionError: ***StartUtteranceBotAction events need to provide 'script' of type 'str'

baravit commented 7 months ago

+1 for still bugging.

For me, it doesn't return the previous error -

AssertionError: ***StartUtteranceBotAction events need to provide 'script' of type 'str'

But just getting an empty response from nemo. Attaching logs - when cap 3 last messages, for my third message - getting an empty response:

INFO:root:Received get-next-message request
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'UtteranceUserActionFinished', 'final_transcript': 'hi'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: UtteranceUserActionFinished {'final_transcript': 'hi'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '31dedc43-167b-43c8-b7c3-0a5d96837e24', 'event_created_at': '2024-04-16T13:12:12.496841+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'UserMessage', 'text': '$user_message'}}, 'action_result_key': None, 'action_uid': '8f4913f9-7e6a-4dfe-bb19-25b2a549e5d8', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '31dedc43-167b-43c8-b7c3-0a5d96837e24', 'event_created_at': '2024-04-16T13:12:12.496841+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'UserMessage', 'text': '$user_message'}}, 'action_result_key': None, 'action_uid': '8f4913f9-7e6a-4dfe-bb19-25b2a549e5d8', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: create_event
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: create_event
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'UserMessage', 'uid': '9a0df215-0624-4fee-aebe-adaeea94f801', 'event_created_at': '2024-04-16T13:12:12.497835+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'hi'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: UserMessage {'uid': '9a0df215-0624-4fee-aebe-adaeea94f801', 'event_created_at': '2024-04-16T13:12:12.497835+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'hi'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '33a15405-9d0e-4a5e-a07d-f1f3c3751c46', 'event_created_at': '2024-04-16T13:12:12.499347+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_user_intent', 'action_params': {}, 'action_result_key': None, 'action_uid': '7130a742-b29d-4fac-9066-71e0d63946bf', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '33a15405-9d0e-4a5e-a07d-f1f3c3751c46', 'event_created_at': '2024-04-16T13:12:12.499347+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_user_intent', 'action_params': {}, 'action_result_key': None, 'action_uid': '7130a742-b29d-4fac-9066-71e0d63946bf', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: generate_user_intent
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: generate_user_intent
INFO:nemoguardrails.actions.llm.generation:Phase 1 :: Generating user intent
INFO:nemoguardrails.logging.callbacks:Invocation Params :: {'model_name': 'gpt-3.5-turbo-instruct', 'temperature': 0.0, 'top_p': 1, 'frequency_penalty': 0, 'presence_penalty': 0, 'n': 1, 'logit_bias': {}, 'max_tokens': 256, '_type': 'openai', 'stop': None}
INFO:nemoguardrails.logging.callbacks:Prompt :: """
You are an AI trading assistant created by traid.
Your name is as the company name - traid.
"""

# This is how a conversation between a user and the bot can go:
user "Hello there!"
  express greeting
bot express greeting
  "Hello! How can I assist you today?"
user "What can you do for me?"
  ask about capabilities
bot respond about capabilities
  "As an AI assistant, I can help you with a wide range of tasks. This includes question answering on various topics, generating text for various purposes and providing suggestions based on your preferences."
user "Tell me a bit about the history of NVIDIA."
  ask general question
bot response for general question
  "NVIDIA is a technology company that specializes in designing and manufacturing graphics processing units (GPUs) and other computer hardware. The company was founded in 1993 by Jen-Hsun Huang, Chris Malachowsky, and Curtis Priem."
user "tell me more"
  request more information
bot provide more information
  "Initially, the company focused on developing 3D graphics processing technology for the PC gaming market. In 1999, NVIDIA released the GeForce 256, the world's first GPU, which was a major breakthrough for the gaming industry. The company continued to innovate in the GPU space, releasing new products and expanding into other markets such as professional graphics, mobile devices, and artificial intelligence."
user "thanks"
  express appreciation
bot express appreciation and offer additional help
  "You're welcome. If you have any more questions or if there's anything else I can help you with, please don't hesitate to ask."

# This is how the user talks:
user "What's going on?"
  ask welfare

user "What can you do for me?"
  ask capabilities

user "Hello"
  express greeting

user "Hey"
  express greeting

user "Hi"
  express greeting

# This is the current conversation between the user and the bot:
# Choose intent from this list: ask welfare, ask capabilities, express greeting
user "Hello there!"
  express greeting
bot express greeting
  "Hello! How can I assist you today?"
user "What can you do for me?"
  ask about capabilities
bot respond about capabilities
  "As an AI assistant, I can help you with a wide range of tasks. This includes question answering on various topics, generating text for various purposes and providing suggestions based on your preferences."
user "hi"

huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
        - Avoid using `tokenizers` before the fork if possible
        - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
        - Avoid using `tokenizers` before the fork if possible
        - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
INFO:httpx:HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
INFO:nemoguardrails.logging.callbacks:Completion ::   express greeting
INFO:nemoguardrails.logging.callbacks:Output Stats :: {'token_usage': {'prompt_tokens': 508, 'completion_tokens': 3, 'total_tokens': 511}, 'model_name': 'gpt-3.5-turbo-instruct'}
INFO:nemoguardrails.logging.callbacks:--- :: LLM call took 0.47 seconds
INFO:nemoguardrails.actions.llm.generation:Canonical form for user intent: express greeting
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'UserIntent', 'uid': '728d3594-db1b-4d0d-aaf9-9c1e1206bb9e', 'event_created_at': '2024-04-16T13:12:13.058970+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'express greeting'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: UserIntent {'uid': '728d3594-db1b-4d0d-aaf9-9c1e1206bb9e', 'event_created_at': '2024-04-16T13:12:13.058970+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'express greeting'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'BotIntent', 'uid': '60c269a8-dddd-4ecb-87fd-e3b4019053c0', 'event_created_at': '2024-04-16T13:12:13.061760+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'greeting'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: BotIntent {'uid': '60c269a8-dddd-4ecb-87fd-e3b4019053c0', 'event_created_at': '2024-04-16T13:12:13.061760+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'greeting'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '3eca1f02-64d1-4334-8da5-abf6af42a46e', 'event_created_at': '2024-04-16T13:12:13.063796+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'action_uid': '4c81a957-2c0c-4e74-9996-fcbf807b3c68', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '3eca1f02-64d1-4334-8da5-abf6af42a46e', 'event_created_at': '2024-04-16T13:12:13.063796+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'action_uid': '4c81a957-2c0c-4e74-9996-fcbf807b3c68', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: retrieve_relevant_chunks
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: retrieve_relevant_chunks
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'InternalSystemActionFinished', 'uid': '12294c94-432d-49f5-8027-c1a08b48f152', 'event_created_at': '2024-04-16T13:12:13.064699+00:00', 'source_uid': 'NeMoGuardrails', 'action_uid': '4c81a957-2c0c-4e74-9996-fcbf807b3c68', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'status': 'success', 'is_success': True, 'return_value': '\n', 'events': None, 'is_system_action': True, 'action_finished_at': '2024-04-16T13:12:13.064730+00:00'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: InternalSystemActionFinished {'uid': '12294c94-432d-49f5-8027-c1a08b48f152', 'event_created_at': '2024-04-16T13:12:13.064699+00:00', 'source_uid': 'NeMoGuardrails', 'action_uid': '4c81a957-2c0c-4e74-9996-fcbf807b3c68', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'status': 'success', 'is_success': True, 'return_value': '\n', 'events': None, 'is_system_action': True, 'action_finished_at': '2024-04-16T13:12:13.064730+00:00'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '034b52d7-c1ee-449a-86af-65d1372e494b', 'event_created_at': '2024-04-16T13:12:13.066936+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_bot_message', 'action_params': {}, 'action_result_key': None, 'action_uid': '445965ee-ad2e-4ff9-bafe-1aa34552b4bd', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '034b52d7-c1ee-449a-86af-65d1372e494b', 'event_created_at': '2024-04-16T13:12:13.066936+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_bot_message', 'action_params': {}, 'action_result_key': None, 'action_uid': '445965ee-ad2e-4ff9-bafe-1aa34552b4bd', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: generate_bot_message
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: generate_bot_message
INFO:nemoguardrails.actions.llm.generation:Phase 3 :: Generating bot message ...
INFO:nemoguardrails.actions.llm.generation:Found existing bot message: Hi body
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'BotMessage', 'uid': '41340271-4885-4ae5-b406-4a75ffc64bda', 'event_created_at': '2024-04-16T13:12:13.070429+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'Hi body'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: BotMessage {'uid': '41340271-4885-4ae5-b406-4a75ffc64bda', 'event_created_at': '2024-04-16T13:12:13.070429+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'Hi body'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '926af56c-9184-48ec-b601-66787b032854', 'event_created_at': '2024-04-16T13:12:13.075728+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'StartUtteranceBotAction', 'script': '$bot_message'}}, 'action_result_key': None, 'action_uid': 'ba525891-ea8f-42e7-a157-81a59459f301', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '926af56c-9184-48ec-b601-66787b032854', 'event_created_at': '2024-04-16T13:12:13.075728+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'StartUtteranceBotAction', 'script': '$bot_message'}}, 'action_result_key': None, 'action_uid': 'ba525891-ea8f-42e7-a157-81a59459f301', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: create_event
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: create_event
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartUtteranceBotAction', 'uid': 'bee7b1e8-659e-4ceb-9203-a65211ef2f90', 'event_created_at': '2024-04-16T13:12:13.077498+00:00', 'source_uid': 'NeMoGuardrails', 'script': 'Hi body', 'action_info_modality': 'bot_speech', 'action_info_modality_policy': 'replace', 'action_uid': 'f68894e3-873a-43e9-93c7-52d4080c70a3'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartUtteranceBotAction {'uid': 'bee7b1e8-659e-4ceb-9203-a65211ef2f90', 'event_created_at': '2024-04-16T13:12:13.077498+00:00', 'source_uid': 'NeMoGuardrails', 'script': 'Hi body', 'action_info_modality': 'bot_speech', 'action_info_modality_policy': 'replace', 'action_uid': 'f68894e3-873a-43e9-93c7-52d4080c70a3'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'BotIntent', 'uid': 'a2fa04d3-60bb-4560-9f2b-42df2e7de106', 'event_created_at': '2024-04-16T13:12:13.082111+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'suggest help'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: BotIntent {'uid': 'a2fa04d3-60bb-4560-9f2b-42df2e7de106', 'event_created_at': '2024-04-16T13:12:13.082111+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'suggest help'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '0647f430-f376-453d-a973-0ae7ad42ebfc', 'event_created_at': '2024-04-16T13:12:13.090565+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'action_uid': '4282de34-c42e-41c5-81a3-dcac92336f6b', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '0647f430-f376-453d-a973-0ae7ad42ebfc', 'event_created_at': '2024-04-16T13:12:13.090565+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'action_uid': '4282de34-c42e-41c5-81a3-dcac92336f6b', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: retrieve_relevant_chunks
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: retrieve_relevant_chunks
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'InternalSystemActionFinished', 'uid': 'aa8001c1-d342-4a06-9f77-9e5d81dda712', 'event_created_at': '2024-04-16T13:12:13.092810+00:00', 'source_uid': 'NeMoGuardrails', 'action_uid': '4282de34-c42e-41c5-81a3-dcac92336f6b', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'status': 'success', 'is_success': True, 'return_value': '\n\n', 'events': None, 'is_system_action': True, 'action_finished_at': '2024-04-16T13:12:13.092854+00:00'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: InternalSystemActionFinished {'uid': 'aa8001c1-d342-4a06-9f77-9e5d81dda712', 'event_created_at': '2024-04-16T13:12:13.092810+00:00', 'source_uid': 'NeMoGuardrails', 'action_uid': '4282de34-c42e-41c5-81a3-dcac92336f6b', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'status': 'success', 'is_success': True, 'return_value': '\n\n', 'events': None, 'is_system_action': True, 'action_finished_at': '2024-04-16T13:12:13.092854+00:00'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '1884b9bd-33b3-45df-bcef-c7734640079e', 'event_created_at': '2024-04-16T13:12:13.098561+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_bot_message', 'action_params': {}, 'action_result_key': None, 'action_uid': 'c00521b4-9aca-4954-b996-d2970dd77306', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '1884b9bd-33b3-45df-bcef-c7734640079e', 'event_created_at': '2024-04-16T13:12:13.098561+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_bot_message', 'action_params': {}, 'action_result_key': None, 'action_uid': 'c00521b4-9aca-4954-b996-d2970dd77306', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: generate_bot_message
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: generate_bot_message
INFO:nemoguardrails.actions.llm.generation:Phase 3 :: Generating bot message ...
INFO:nemoguardrails.actions.llm.generation:Found existing bot message: What can I do for you today?
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'BotMessage', 'uid': '91b16c38-b5a0-48ae-9d1c-73c01270eb1a', 'event_created_at': '2024-04-16T13:12:13.101561+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'What can I do for you today?'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: BotMessage {'uid': '91b16c38-b5a0-48ae-9d1c-73c01270eb1a', 'event_created_at': '2024-04-16T13:12:13.101561+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'What can I do for you today?'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '31c88608-b0d9-414a-acd6-ae904dc80ee4', 'event_created_at': '2024-04-16T13:12:13.109817+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'StartUtteranceBotAction', 'script': '$bot_message'}}, 'action_result_key': None, 'action_uid': '9d4cbe0a-ddee-4b34-a78b-ab1ecc26487c', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '31c88608-b0d9-414a-acd6-ae904dc80ee4', 'event_created_at': '2024-04-16T13:12:13.109817+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'StartUtteranceBotAction', 'script': '$bot_message'}}, 'action_result_key': None, 'action_uid': '9d4cbe0a-ddee-4b34-a78b-ab1ecc26487c', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: create_event
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: create_event
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartUtteranceBotAction', 'uid': '31f5361b-10a2-44de-99f5-54e25b9efb04', 'event_created_at': '2024-04-16T13:12:13.111451+00:00', 'source_uid': 'NeMoGuardrails', 'script': 'What can I do for you today?', 'action_info_modality': 'bot_speech', 'action_info_modality_policy': 'replace', 'action_uid': '41d5c9a2-0f93-49ee-b0a6-d630b0a0dc60'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartUtteranceBotAction {'uid': '31f5361b-10a2-44de-99f5-54e25b9efb04', 'event_created_at': '2024-04-16T13:12:13.111451+00:00', 'source_uid': 'NeMoGuardrails', 'script': 'What can I do for you today?', 'action_info_modality': 'bot_speech', 'action_info_modality_policy': 'replace', 'action_uid': '41d5c9a2-0f93-49ee-b0a6-d630b0a0dc60'}
INFO:nemoguardrails.rails.llm.llmrails:--- :: Total processing took 0.62 seconds. LLM Stats: 1 total calls, 0.47 total time, 511 total tokens, 508 total prompt tokens, 3 total completion tokens, [0.47] as latencies
INFO:root:Bot response: {'role': 'assistant', 'content': 'Hi body\nWhat can I do for you today?'}
INFO:     ::1:62543 - "POST /get-next-message HTTP/1.1" 200 OK
INFO:root:Received get-next-message request
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'UtteranceUserActionFinished', 'final_transcript': 'whats up'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: UtteranceUserActionFinished {'final_transcript': 'whats up'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '1fd78052-f29f-48c2-a9c6-93182d0e5bab', 'event_created_at': '2024-04-16T13:12:15.605204+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'UserMessage', 'text': '$user_message'}}, 'action_result_key': None, 'action_uid': 'a787227a-71f4-4d8b-8e78-8dcc312e0446', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '1fd78052-f29f-48c2-a9c6-93182d0e5bab', 'event_created_at': '2024-04-16T13:12:15.605204+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'UserMessage', 'text': '$user_message'}}, 'action_result_key': None, 'action_uid': 'a787227a-71f4-4d8b-8e78-8dcc312e0446', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: create_event
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: create_event
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'UserMessage', 'uid': '89c20e4a-835b-4b06-8bba-7862fe143d61', 'event_created_at': '2024-04-16T13:12:15.605962+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'whats up'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: UserMessage {'uid': '89c20e4a-835b-4b06-8bba-7862fe143d61', 'event_created_at': '2024-04-16T13:12:15.605962+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'whats up'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': 'c6eb30ae-8175-460c-98c8-9952fdbaa2f4', 'event_created_at': '2024-04-16T13:12:15.612943+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_user_intent', 'action_params': {}, 'action_result_key': None, 'action_uid': 'c724a0ce-5ec0-4c20-afd9-9b1110bbdee1', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': 'c6eb30ae-8175-460c-98c8-9952fdbaa2f4', 'event_created_at': '2024-04-16T13:12:15.612943+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_user_intent', 'action_params': {}, 'action_result_key': None, 'action_uid': 'c724a0ce-5ec0-4c20-afd9-9b1110bbdee1', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: generate_user_intent
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: generate_user_intent
INFO:nemoguardrails.actions.llm.generation:Phase 1 :: Generating user intent
INFO:nemoguardrails.logging.callbacks:Invocation Params :: {'model_name': 'gpt-3.5-turbo-instruct', 'temperature': 0.0, 'top_p': 1, 'frequency_penalty': 0, 'presence_penalty': 0, 'n': 1, 'logit_bias': {}, 'max_tokens': 256, '_type': 'openai', 'stop': None}
INFO:nemoguardrails.logging.callbacks:Prompt :: """
You are an AI trading assistant created by traid.
Your name is as the company name - traid.
"""

# This is how a conversation between a user and the bot can go:
user "Hello there!"
  express greeting
bot express greeting
  "Hello! How can I assist you today?"
user "What can you do for me?"
  ask about capabilities
bot respond about capabilities
  "As an AI assistant, I can help you with a wide range of tasks. This includes question answering on various topics, generating text for various purposes and providing suggestions based on your preferences."
user "Tell me a bit about the history of NVIDIA."
  ask general question
bot response for general question
  "NVIDIA is a technology company that specializes in designing and manufacturing graphics processing units (GPUs) and other computer hardware. The company was founded in 1993 by Jen-Hsun Huang, Chris Malachowsky, and Curtis Priem."
user "tell me more"
  request more information
bot provide more information
  "Initially, the company focused on developing 3D graphics processing technology for the PC gaming market. In 1999, NVIDIA released the GeForce 256, the world's first GPU, which was a major breakthrough for the gaming industry. The company continued to innovate in the GPU space, releasing new products and expanding into other markets such as professional graphics, mobile devices, and artificial intelligence."
user "thanks"
  express appreciation
bot express appreciation and offer additional help
  "You're welcome. If you have any more questions or if there's anything else I can help you with, please don't hesitate to ask."

# This is how the user talks:
user "How you doing?"
  ask welfare

user "What you good for?"
  ask capabilities

user "What's going on?"
  ask welfare

user "How's it going?"
  ask welfare

user "What's up?"
  ask welfare

# This is the current conversation between the user and the bot:
# Choose intent from this list: ask welfare, ask capabilities
user "Hello there!"
  express greeting
bot express greeting
  "Hello! How can I assist you today?"
user "What can you do for me?"
  ask about capabilities
bot respond about capabilities
  "As an AI assistant, I can help you with a wide range of tasks. This includes question answering on various topics, generating text for various purposes and providing suggestions based on your preferences."
user "hi"
  express greeting
bot greeting
  "Hi body"
bot suggest help
  "What can I do for you today?"
user "whats up"

INFO:httpx:HTTP Request: POST https://api.openai.com/v1/completions "HTTP/1.1 200 OK"
INFO:nemoguardrails.logging.callbacks:Completion ::   ask welfare
bot respond about welfare
  "I am doing well, thank you for asking. How about you?"
INFO:nemoguardrails.logging.callbacks:Output Stats :: {'token_usage': {'prompt_tokens': 542, 'completion_tokens': 25, 'total_tokens': 567}, 'model_name': 'gpt-3.5-turbo-instruct'}
INFO:nemoguardrails.logging.callbacks:--- :: LLM call took 0.53 seconds
INFO:nemoguardrails.actions.llm.generation:Canonical form for user intent: ask welfare
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'UserIntent', 'uid': '2e1d94c4-e636-4547-bf95-e131310e95a3', 'event_created_at': '2024-04-16T13:12:16.176759+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'ask welfare'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: UserIntent {'uid': '2e1d94c4-e636-4547-bf95-e131310e95a3', 'event_created_at': '2024-04-16T13:12:16.176759+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'ask welfare'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'BotIntent', 'uid': '163bd282-f171-4b4b-b892-a58249fa1c0a', 'event_created_at': '2024-04-16T13:12:16.182912+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'respond about welfare'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: BotIntent {'uid': '163bd282-f171-4b4b-b892-a58249fa1c0a', 'event_created_at': '2024-04-16T13:12:16.182912+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'respond about welfare'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '9ce2ba21-102d-4ebd-ab79-8cd6c9c07be7', 'event_created_at': '2024-04-16T13:12:16.190710+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'action_uid': '2e936187-0bfb-4a10-afea-4c79bcfd2cf9', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '9ce2ba21-102d-4ebd-ab79-8cd6c9c07be7', 'event_created_at': '2024-04-16T13:12:16.190710+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'action_uid': '2e936187-0bfb-4a10-afea-4c79bcfd2cf9', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: retrieve_relevant_chunks
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: retrieve_relevant_chunks
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'InternalSystemActionFinished', 'uid': 'ccaf9fdc-2282-4bd4-ac1b-f3915191254d', 'event_created_at': '2024-04-16T13:12:16.192392+00:00', 'source_uid': 'NeMoGuardrails', 'action_uid': '2e936187-0bfb-4a10-afea-4c79bcfd2cf9', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'status': 'success', 'is_success': True, 'return_value': '\n\n\n', 'events': None, 'is_system_action': True, 'action_finished_at': '2024-04-16T13:12:16.192416+00:00'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: InternalSystemActionFinished {'uid': 'ccaf9fdc-2282-4bd4-ac1b-f3915191254d', 'event_created_at': '2024-04-16T13:12:16.192392+00:00', 'source_uid': 'NeMoGuardrails', 'action_uid': '2e936187-0bfb-4a10-afea-4c79bcfd2cf9', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'status': 'success', 'is_success': True, 'return_value': '\n\n\n', 'events': None, 'is_system_action': True, 'action_finished_at': '2024-04-16T13:12:16.192416+00:00'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '41f66419-3655-41a0-8940-9d21a9e0e56a', 'event_created_at': '2024-04-16T13:12:16.200449+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_bot_message', 'action_params': {}, 'action_result_key': None, 'action_uid': '7a061616-9c22-4fc3-b2ca-75c97970f30e', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '41f66419-3655-41a0-8940-9d21a9e0e56a', 'event_created_at': '2024-04-16T13:12:16.200449+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_bot_message', 'action_params': {}, 'action_result_key': None, 'action_uid': '7a061616-9c22-4fc3-b2ca-75c97970f30e', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: generate_bot_message
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: generate_bot_message
INFO:nemoguardrails.actions.llm.generation:Phase 3 :: Generating bot message ...
INFO:nemoguardrails.actions.llm.generation:Found existing bot message: I'm doing ok! you are the boss for asking!
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'BotMessage', 'uid': '7cbaa65e-eea6-4f93-b8ac-fdc615b8838c', 'event_created_at': '2024-04-16T13:12:16.203247+00:00', 'source_uid': 'NeMoGuardrails', 'text': "I'm doing ok! you are the boss for asking!"}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: BotMessage {'uid': '7cbaa65e-eea6-4f93-b8ac-fdc615b8838c', 'event_created_at': '2024-04-16T13:12:16.203247+00:00', 'source_uid': 'NeMoGuardrails', 'text': "I'm doing ok! you are the boss for asking!"}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '95eba01a-0d39-4e98-a7e1-1c945575fccc', 'event_created_at': '2024-04-16T13:12:16.213626+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'StartUtteranceBotAction', 'script': '$bot_message'}}, 'action_result_key': None, 'action_uid': '57468353-1a9d-4445-8df5-00e3f2611eb0', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '95eba01a-0d39-4e98-a7e1-1c945575fccc', 'event_created_at': '2024-04-16T13:12:16.213626+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'StartUtteranceBotAction', 'script': '$bot_message'}}, 'action_result_key': None, 'action_uid': '57468353-1a9d-4445-8df5-00e3f2611eb0', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: create_event
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: create_event
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartUtteranceBotAction', 'uid': '61197b47-98af-4c79-9865-4773e1556ee1', 'event_created_at': '2024-04-16T13:12:16.214401+00:00', 'source_uid': 'NeMoGuardrails', 'script': "I'm doing ok! you are the boss for asking!", 'action_info_modality': 'bot_speech', 'action_info_modality_policy': 'replace', 'action_uid': 'cc803230-569b-422b-8ef6-363ce0418d76'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartUtteranceBotAction {'uid': '61197b47-98af-4c79-9865-4773e1556ee1', 'event_created_at': '2024-04-16T13:12:16.214401+00:00', 'source_uid': 'NeMoGuardrails', 'script': "I'm doing ok! you are the boss for asking!", 'action_info_modality': 'bot_speech', 'action_info_modality_policy': 'replace', 'action_uid': 'cc803230-569b-422b-8ef6-363ce0418d76'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'BotIntent', 'uid': '216db73a-7ade-490b-8e15-dedb13ba6100', 'event_created_at': '2024-04-16T13:12:16.223699+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'suggest help'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: BotIntent {'uid': '216db73a-7ade-490b-8e15-dedb13ba6100', 'event_created_at': '2024-04-16T13:12:16.223699+00:00', 'source_uid': 'NeMoGuardrails', 'intent': 'suggest help'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '7e2ac0c5-da28-48fd-8fdd-2b09c2a6cd0b', 'event_created_at': '2024-04-16T13:12:16.233007+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'action_uid': '3fa6e2b1-d774-4155-9cf3-472cb78679f5', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '7e2ac0c5-da28-48fd-8fdd-2b09c2a6cd0b', 'event_created_at': '2024-04-16T13:12:16.233007+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'action_uid': '3fa6e2b1-d774-4155-9cf3-472cb78679f5', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: retrieve_relevant_chunks
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: retrieve_relevant_chunks
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'InternalSystemActionFinished', 'uid': 'cf41dad5-a9f1-48d8-874e-0abe6f03169d', 'event_created_at': '2024-04-16T13:12:16.234141+00:00', 'source_uid': 'NeMoGuardrails', 'action_uid': '3fa6e2b1-d774-4155-9cf3-472cb78679f5', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'status': 'success', 'is_success': True, 'return_value': '\n\n\n\n', 'events': None, 'is_system_action': True, 'action_finished_at': '2024-04-16T13:12:16.234163+00:00'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: InternalSystemActionFinished {'uid': 'cf41dad5-a9f1-48d8-874e-0abe6f03169d', 'event_created_at': '2024-04-16T13:12:16.234141+00:00', 'source_uid': 'NeMoGuardrails', 'action_uid': '3fa6e2b1-d774-4155-9cf3-472cb78679f5', 'action_name': 'retrieve_relevant_chunks', 'action_params': {}, 'action_result_key': None, 'status': 'success', 'is_success': True, 'return_value': '\n\n\n\n', 'events': None, 'is_system_action': True, 'action_finished_at': '2024-04-16T13:12:16.234163+00:00'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '59ad0755-b34d-45db-8997-732e3ecfe7c9', 'event_created_at': '2024-04-16T13:12:16.251763+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_bot_message', 'action_params': {}, 'action_result_key': None, 'action_uid': '5bdc1be0-6b15-497b-8661-1c11e00daafe', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '59ad0755-b34d-45db-8997-732e3ecfe7c9', 'event_created_at': '2024-04-16T13:12:16.251763+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'generate_bot_message', 'action_params': {}, 'action_result_key': None, 'action_uid': '5bdc1be0-6b15-497b-8661-1c11e00daafe', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: generate_bot_message
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: generate_bot_message
INFO:nemoguardrails.actions.llm.generation:Phase 3 :: Generating bot message ...
INFO:nemoguardrails.actions.llm.generation:Found existing bot message: How can I help you?
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'BotMessage', 'uid': '1cb01464-0d65-43d8-9695-9795b5f06bed', 'event_created_at': '2024-04-16T13:12:16.255060+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'How can I help you?'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: BotMessage {'uid': '1cb01464-0d65-43d8-9695-9795b5f06bed', 'event_created_at': '2024-04-16T13:12:16.255060+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'How can I help you?'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': 'c1ab7686-107f-4a84-8f0d-c3757e757f10', 'event_created_at': '2024-04-16T13:12:16.269796+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'StartUtteranceBotAction', 'script': '$bot_message'}}, 'action_result_key': None, 'action_uid': 'fef75d43-6dc7-43d9-a690-ab3f4ccb2b56', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': 'c1ab7686-107f-4a84-8f0d-c3757e757f10', 'event_created_at': '2024-04-16T13:12:16.269796+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'StartUtteranceBotAction', 'script': '$bot_message'}}, 'action_result_key': None, 'action_uid': 'fef75d43-6dc7-43d9-a690-ab3f4ccb2b56', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: create_event
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: create_event
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartUtteranceBotAction', 'uid': '39048206-7295-414e-8970-26f186db9dd3', 'event_created_at': '2024-04-16T13:12:16.277025+00:00', 'source_uid': 'NeMoGuardrails', 'script': 'How can I help you?', 'action_info_modality': 'bot_speech', 'action_info_modality_policy': 'replace', 'action_uid': '395e7c27-d1f7-4a77-b4be-101497a1c5c2'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartUtteranceBotAction {'uid': '39048206-7295-414e-8970-26f186db9dd3', 'event_created_at': '2024-04-16T13:12:16.277025+00:00', 'source_uid': 'NeMoGuardrails', 'script': 'How can I help you?', 'action_info_modality': 'bot_speech', 'action_info_modality_policy': 'replace', 'action_uid': '395e7c27-d1f7-4a77-b4be-101497a1c5c2'}
INFO:nemoguardrails.rails.llm.llmrails:--- :: Total processing took 0.69 seconds. LLM Stats: 1 total calls, 0.53 total time, 567 total tokens, 542 total prompt tokens, 25 total completion tokens, [0.53] as latencies
INFO:root:Bot response: {'role': 'assistant', 'content': "I'm doing ok! you are the boss for asking!\nHow can I help you?"}
INFO:     ::1:62543 - "POST /get-next-message HTTP/1.1" 200 OK
INFO:root:Received get-next-message request
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'UtteranceUserActionFinished', 'final_transcript': 'What can you do?'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: UtteranceUserActionFinished {'final_transcript': 'What can you do?'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'StartInternalSystemAction', 'uid': '538cb1e4-fa8d-42ef-ad2c-da12867a2fec', 'event_created_at': '2024-04-16T13:12:18.109594+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'UserMessage', 'text': '$user_message'}}, 'action_result_key': None, 'action_uid': '3d76679a-450e-4266-ac5f-29f50311fd89', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: StartInternalSystemAction {'uid': '538cb1e4-fa8d-42ef-ad2c-da12867a2fec', 'event_created_at': '2024-04-16T13:12:18.109594+00:00', 'source_uid': 'NeMoGuardrails', 'action_name': 'create_event', 'action_params': {'event': {'_type': 'UserMessage', 'text': '$user_message'}}, 'action_result_key': None, 'action_uid': '3d76679a-450e-4266-ac5f-29f50311fd89', 'is_system_action': True}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Executing action :: create_event
INFO:nemoguardrails.actions.action_dispatcher:Executing registered action: create_event
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Processing event: {'type': 'UserMessage', 'uid': '24d2132f-c244-4bdd-8709-c10a2488c639', 'event_created_at': '2024-04-16T13:12:18.110280+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'What can you do?'}
INFO:nemoguardrails.colang.v1_0.runtime.runtime:Event :: UserMessage {'uid': '24d2132f-c244-4bdd-8709-c10a2488c639', 'event_created_at': '2024-04-16T13:12:18.110280+00:00', 'source_uid': 'NeMoGuardrails', 'text': 'What can you do?'}
INFO:nemoguardrails.rails.llm.llmrails:--- :: Total processing took 0.01 seconds. LLM Stats: 0 total calls, 0 total time, 0 total tokens, 0 total prompt tokens, 0 total completion tokens, [] as latencies
INFO:root:Bot response: {'role': 'assistant', 'content': ''}
INFO:     ::1:62543 - "POST /get-next-message HTTP/1.1" 200 OK
saradiazdelser commented 6 months ago

Hi!! I was having the same issue with the empty response. Commenting out a few lines 451-458 in nemoguardrails/rails/llm/llmrails.py seems to fix it. Here's the PR: https://github.com/NVIDIA/NeMo-Guardrails/pull/465

drazvan commented 6 months ago

@baravit : can you provide a complete config and steps to reproduce? Thanks!

visheshgitrepo commented 6 months ago

Hi @drazvan This conversation history is not resolved yet, tried with develop branch. Can you give an example of conversation history with relevant chunks for each conversation, which it worked for you. Like first with user_query and relevant_chunk --> get generated_response --> store it. Then again followup user_query with relevant chunk along with previous query and/or LLM response --> generated_response --> store it.

Something of this sort

baravit commented 6 months ago

Hi @drazvan.

Here is full code to reproduce:

from nemoguardrails import LLMRails, RailsConfig
from dotenv import load_dotenv

import logging
logLevel = logging.INFO
logging.basicConfig(level=logLevel)

load_dotenv()

YAML_CONFIG = """
models:
  - type: main
    engine: openai
    model: gpt-3.5-turbo
"""
COLANG_CONFIG = """
define user express greeting
  "hey"
  "hello"
  "hi"

define bot express greeting
  "Hello"

define user ask welfare
  "what's up?"

define bot reply welfare
  "I'm super"

define flow
  user express greeting
  bot express greeting
"""

config = RailsConfig.from_content(COLANG_CONFIG, YAML_CONFIG)
rails = LLMRails(config, verbose=True)

def main():
    history = [
        {"role": "user", "content": "Hi"},
        {"role": "assistant", "content": "Hi, How can I help you today 🙂?"},
        {"role": "user", "content": "What's up?"},
    ]
    result = rails.generate(messages=history)
    print(result)

if __name__ == "__main__":
    main()
visheshgitrepo commented 6 months ago

@drazvan Any update on this, is issue resolved in latest release for conversation history. If yes, do you have any notebook or working example

curefatih commented 6 months ago

I am getting same error. when I debug I see that after UserMessage event it creates no additional event which in that case it I am getting same error. when I debug I see that after UserMessage event it creates no additional event which in that case it creates a Listen event that breaks the new event loop. After all this there is no StartUtteranceBotAction in new events which causing empty join and response. I tried to understand why it is behaving like that but couldn't.

https://github.com/NVIDIA/NeMo-Guardrails/blob/a38cc5d6e6dcebe2cd4eae2c5791bd7d7af7d503/nemoguardrails/colang/v1_0/runtime/runtime.py#L182-L183

https://github.com/NVIDIA/NeMo-Guardrails/blob/a38cc5d6e6dcebe2cd4eae2c5791bd7d7af7d503/nemoguardrails/rails/llm/llmrails.py#L706

naimTurkdogan commented 5 months ago

Hi @drazvan, this issue that returning empty response still exist on 0.9.0 also. Is there any plan to fix it? Or the accepted execution way is like that?

drazvan commented 5 months ago

Thanks for following up, @naimTurkdogan! This was a difficult one. The fix has just been merged as part of #539. The actual commit was this (https://github.com/NVIDIA/NeMo-Guardrails/pull/539/commits/5cc434aa6a1353c03d4d42f87547a810fa9812cc). It may seem unrelated, but that was the root cause. cc @curefatih @visheshgitrepo @baravit @saradiazdelser

naimTurkdogan commented 5 months ago

Thanks for your effort and quick return @drazvan . It looks like that fix works well in my test cases. Is there any determined date for patch releasing with this fix.

drazvan commented 5 months ago

We don't have a patch release planned for this. We'll release 0.10.0 at the end of the month, and it will be part of that.

d-shree commented 4 months ago

@drazvan - Any update on when the 0.10.0 version will released?

naimTurkdogan commented 3 months ago

Hi @drazvan, is there any progress or new planning for 0.10.0 release?

drazvan commented 3 months ago

This has now been released as part of 0.9.1. The 0.10.0 is pushed out for a few more weeks.