Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions chatbot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,15 @@ def read_agent_response(event_stream):
data = event['chunk']['bytes']
agent_answer = data.decode('utf8')
elif 'trace' in event:
print(f"orchestration trace = {event['trace']['trace']['orchestrationTrace']}")
if 'observation' in event['trace']['trace']['orchestrationTrace']:
if event['trace']['trace']['orchestrationTrace']['observation']['type'] == "ASK_USER":
ask_user = True
tr = event['trace']['trace'] # Trace object in seperate variable
orch = tr.get('orchestrationTrace') # Trying to get orchestrationTrace from trace. Diretly calling orchestrationTrace from trace was throwing exception if model access was not properly provided
if orch:
print(f"orchestration trace = {event['trace']['trace']['orchestrationTrace']}") # This line was throwing key error on orchestrationTrace, if model access is not valid, fixed in above line
if 'observation' in event['trace']['trace']['orchestrationTrace']:
if event['trace']['trace']['orchestrationTrace']['observation']['type'] == "ASK_USER":
ask_user = True
else:
ask_user = False
else:
ask_user = False
else:
Expand Down