Skip to content

Commit

Permalink
Fix issue with keyerror in list comprehension (microsoft#775)
Browse files Browse the repository at this point in the history
Co-authored-by: Abby Hartman <[email protected]>
  • Loading branch information
2 people authored and rafaelbaum committed May 6, 2024
1 parent 8fbdcaf commit 6301d2f
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 @@ -829,7 +829,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

0 comments on commit 6301d2f

Please sign in to comment.