Unverified Commit 2b157d89 authored by Tanmay Verma's avatar Tanmay Verma Committed by GitHub
Browse files

fix: Allow requests to include audio contents before text (#5143)

parent 6be9c9a4
......@@ -204,11 +204,15 @@ class Processor(ProcessMixIn):
if "<prompt>" not in template:
raise ValueError("prompt_template must contain '<prompt>' placeholder")
# Safely extract user text
try:
user_text = raw_request.messages[0].content[0].text
except (IndexError, AttributeError) as e:
raise ValueError(f"Invalid message structure: {e}")
# Safely extract user text - find the text content item
user_text = None
for message in raw_request.messages:
for item in message.content:
if item.type == "text":
user_text = item.text
break
if user_text is None:
raise ValueError("No text content found in the request messages")
prompt = template.replace("<prompt>", user_text)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment