Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Getting an error when answering questions using KB - Unexpected token Token('$END', '') at line 2, column 87 #1026

Open
3 of 4 tasks
jagiboy opened this issue Mar 5, 2025 · 0 comments
Labels
bug Something isn't working status: needs triage New issues that have not yet been reviewed or categorized.

Comments

@jagiboy
Copy link

jagiboy commented Mar 5, 2025

Did you check docs and existing issues?

  • I have read all the NeMo-Guardrails docs
  • I have updated the package to the latest version before submitting this issue
  • (optional) I have used the develop branch
  • I have searched the existing issues of NeMo-Guardrails

Python version (python --version)

3.11

Operating system/version

MacOS 15.3

NeMo-Guardrails version (if you must use a specific version and not the latest

0.12.0

Describe the bug

Trying to answer user questions using documents in KB and getting this error consistently after a few questions are asked This does not happen consistently. Using Colang 2.0. Here is the simple flow that uses "when user asks about policies" to answer user question from the KB


flow main
activate automating intent detection
activate generating user intent for unhandled user utterance

global $user_language
$response_type = await select language

while True:
if $response_type == "continue"
await select intent

flow select intent
bot provides assistance
when user asks about policies
llm continue interaction
or when user asks about application status
activate get application status
or when user asks about benefit amount
activate get benefit amount
or when user asks about appointment
activate get appointment details
or when unhandled user intent as $ref
bot say "got intent: {$ref.intent}"

DEBUG All internal event processed -> advance actionable heads: statemachine.py:419
INFO Running action :: AddFlowsAction runtime.py:262
INFO Executing registered action: AddFlowsAction action_dispatcher.py:198
INFO Start AddFlowsAction! {'config': '@meta(bot_intent="bot provide information about vehicle value_and_TCA eligibility")\nflow _dynamic_cc9dca07 runtime.py:71
bot provide information about vehicle value_and_TCA eligibility\n '}
WARNING Failed parsing a generated flow runtime.py:86
@meta(bot_intent="bot provide information about vehicle value_and_TCA eligibility")
flow _dynamic_cc9dca07 bot provide information about vehicle value_and_TCA eligibility

                         Unexpected token Token('$END', '') at line 2, column 87.                                                                                                      
                         Expected one of:                                                                                                                                              
                                 * _INDENT                                                                                                                                             
                         :                                                                                                                                                             
                         flow _dynamic_cc9dca07 bot provide information about vehicle value_and_TCA eligibility                                                                        
                                                                                                               ^                                                                       
                WARNING  Using the following flow instead:                                                                                                                runtime.py:97
                         flow provide information about vehicle value_and_TCA eligibility")                                                                                            
                           bot say "Internal error on flow `provide information about vehicle value_and_TCA eligibility")`."                                                           
                WARNING  Error while execution 'AddFlowsAction' with parameters '{'config': '@meta(bot_intent="bot provide information about vehicle           action_dispatcher.py:261
                         value_and_TCA eligibility")\nflow _dynamic_cc9dca07 bot provide information about vehicle value_and_TCA eligibility\n  '}': No                                
                         terminal matches '"' in the current parser context, at line 1 col 65                                                                                          
                                                                                                                                                                                       
                          about vehicle value_and_TCA eligibility")                                                                                                                    
                                                                 ^                                                                                                                     
                         Expected one of:                                                                                                                                              
                                 * _NEWLINE                                                                                                                                            
                                 * LONG_STRING                                                                                                                                         
                                 * DEC_NUMBER                                                                                                                                          
                                 * "->"                                                                                                                                                
                                 * _AND                                                                                                                                                
                                 * _OR                                                                                                                                                 
                                 * NAME                                                                                                                                                
                                 * STRING                                                                                                                                              
                                 * PLUS                                                                                                                                                
                                 * RPAR                                                                                                                                                
                                 * FLOAT_NUMBER                                                                                                                                        
                                 * MINUS                                                                                                                                               
                                 * TILDE                                                                                                                                               
                                 * DOT                                                                                                                                                 
                                 * EQUAL                                                                                                                                               
                                 * COLON                                                                                                                                               
                                 * LBRACE                                                                                                                                              
                                 * VAR_NAME                                                                                                                                            
                                 * LPAR                                                                                                                                                
                                 * LSQB                                                                                                                                                
                                                                                                                                                                                       
                         Previous tokens: Token('NAME', 'eligibility')                                                                                                                 

⠸ Working (16 events processed)... ERROR No terminal matches '"' in the current parser context, at line 1 col 65 action_dispatcher.py:267

                          about vehicle value_and_TCA eligibility")                                                                                                                    
                                                                 ^                                                                                                                     
                         Expected one of:                                                                                                                                              
                                 * _NEWLINE                                                                                                                                            
                                 * LONG_STRING                                                                                                                                         
                                 * DEC_NUMBER                                                                                                                                          
                                 * "->"                                                                                                                                                
                                 * _AND                                                                                                                                                
                                 * _OR                                                                                                                                                 
                                 * NAME                                                                                                                                                
                                 * STRING                                                                                                                                              
                                 * PLUS                                                                                                                                                
                                 * RPAR                                                                                                                                                
                                 * FLOAT_NUMBER                                                                                                                                        
                                 * MINUS                                                                                                                                               
                                 * TILDE                                                                                                                                               
                                 * DOT                                                                                                                                                 
                                 * EQUAL                                                                                                                                               
                                 * COLON                                                                                                                                               
                                 * LBRACE                                                                                                                                              
                                 * VAR_NAME                                                                                                                                            
                                 * LPAR                                                                                                                                                
                                 * LSQB                                                                                                                                                
                                                                                                                                                                                       
                         Previous tokens: Token('NAME', 'eligibility')     

Steps To Reproduce

  1. Add documents to KB
  2. Use llm continue interaction
  3. Chat with bot

Expected Behavior

No error should be happen

Actual Behavior

Expecting the bot to summarize the content extracted from the kb

@jagiboy jagiboy added bug Something isn't working status: needs triage New issues that have not yet been reviewed or categorized. labels Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status: needs triage New issues that have not yet been reviewed or categorized.
Projects
None yet
Development

No branches or pull requests

1 participant