Skip to content

Commit

Permalink
Fix issue with keyerror in list comprehension (#775)
Browse files Browse the repository at this point in the history
Co-authored-by: Abby Hartman <[email protected]>
  • Loading branch information
abhahn and Abby Hartman authored Apr 13, 2024
1 parent ec893de commit e72c68e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,12 @@ async def promptflow_request(request):


async def send_chat_request(request):
filtered_messages = [message for message in request['messages'] if message['role'] != 'tool']
filtered_messages = []
messages = request.get("messages", [])
for message in messages:
if message.get("role") != 'tool':
filtered_messages.append(message)

request['messages'] = filtered_messages
model_args = prepare_model_args(request)

Expand Down

1 comment on commit e72c68e

@Schoemann
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you :-)

Please sign in to comment.