Skip to content

Commit

Permalink
Fix: Check for empty tool message in history/update (#375)
Browse files Browse the repository at this point in the history
Co-authored-by: Ian Seabock (Centific Technologies Inc) <[email protected]>
  • Loading branch information
iseabock and Ian Seabock (Centific Technologies Inc) committed Nov 9, 2023
1 parent 86de997 commit 954de60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def update_conversation():
## then write it to the conversation history in cosmos
messages = request.json["messages"]
if len(messages) > 0 and messages[-1]['role'] == "assistant":
if len(messages) > 1 and messages[-2]['role'] == "tool":
if len(messages) > 1 and messages[-2] != {} and messages[-2]['role'] == "tool":
# write the tool message first
cosmos_conversation_client.create_message(
conversation_id=conversation_id,
Expand Down

0 comments on commit 954de60

Please sign in to comment.