NeMo-Guardrails icon indicating copy to clipboard operation
NeMo-Guardrails copied to clipboard

How to get debug output on a Lambda function?

Open donatoaz opened this issue 1 year ago • 5 comments

I have an AWS Lambda function using Guardrails and on my handler file I do already run

logging.basicConfig(level=logging.DEBUG)

However I am not getting log messages beyond WARNING and ERROR.

I am trying to troubleshoot an error that I assume is being caused by matching a flow with an action and giving literal_eval a json string:

[ERROR]	2023-12-12T21:26:35.477Z	7d7830e1-be0a-4ae5-9997-f23d8b3520d7	Error malformed node or string on line 1: <ast.Call object at 0x7f78553181c0> while execution generate_value

Traceback (most recent call last):
File "/var/lang/lib/python3.11/site-packages/nemoguardrails/actions/action_dispatcher.py", line 136, in execute_action
result = await fn(**params)
^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/site-packages/nemoguardrails/actions/llm/generation.py", line 613, in generate_value
return literal_eval(value)
^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/ast.py", line 110, in literal_eval
return _convert(node_or_string)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/ast.py", line 109, in _convert
return _convert_signed_num(node)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/ast.py", line 83, in _convert_signed_num
return _convert_num(node)
^^^^^^^^^^^^^^^^^^
File "/var/lang/lib/python3.11/ast.py", line 74, in _convert_num
_raise_malformed_node(node)
File "/var/lang/lib/python3.11/ast.py", line 71, in _raise_malformed_node
raise ValueError(msg + f': {node!r}')
ValueError: malformed node or string on line 1: <ast.Call object at 0x7f78553181c0>[INFO]	2023-12-12T21:26:35.481Z	7d7830e1-be0a-4ae5-9997-f23d8b3520d7	NeMo Guardrails returned {'role': 'assistant', 'content': "I'm sorry, an internal error has occurred."}

Any suggestions on how I can get more detailed debug output when running on lambda?

donatoaz avatar Dec 12 '23 21:12 donatoaz