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 10, 2024
1 parent d107e8a commit 48d2c5a
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 @@ -848,7 +848,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 48d2c5a

Please sign in to comment.