-
Notifications
You must be signed in to change notification settings - Fork 225
Open
Description
When sending a POST request to the /v1/responses endpoint with the parameter input, the API returns a 500 error with the message:
{"error":"no messages in fragment"}
500
{"id":"","object":"","created_at":0,"status":"","error":"no messages in fragment","incomplete_details":null,"instructions":null,"max_output_tokens":null,"model":"","output":null,"parallel_tool_calls":false,"previous_response_id":null,"reasoning":{},"store":false,"temperature":0,"text":{},"tool_choice":"","tools":null,"top_p":0,"truncation":"","usage":{"input_tokens":0,"input_tokens_details":{"cached_tokens":0},"output_tokens":0,"output_tokens_details":{"cached_tokens":0},"total_tokens":0},"user":null,"metadata":null}
Steps to Reproduce
- Send a request similar to the following:
import requests, json
url = "http://localhost:8080/v1/responses"
headers = {"Content-Type": "application/json"}
data = {
"model": "LocalAI_Agent",
"input": [
{
"role": "user",
"content": [
{"type": "input_text", "text": "what is in this image?"},
{
"type": "input_image",
"image_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMsAAAD4CAMAAAB1y+ICAAAB6VBMVEAFADpnqTrj4znsqTZb3kfTWF7CCC3CiuAAAkAFRY9PUcAVmIAJS1/ZA2xkQVENwLPrg1gUwqzmgpeBh6YABmZfgtHMwhmVwWdfgN7cAl3aCr73QEeVnLtUXp5oprleXrnuVZDCZTINtydpLvb0tidZfG9H28RZi7FeL5H/otPT/AdHKBBs1r1ZSAAAAAElFTkSuQmCC..."
}
]
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.status_code, response.text)Expected Behavior
Should return a valid model response analyzing the text and image input.
Actual Behavior
Returns:
500 Internal Server Error
{"error":"no messages in fragment"}
Possible Cause
The /v1/responses endpoint appears to require a messages array instead of an input array, following the newer message-based schema. When using input, the request payload does not match the expected structure, causing the backend to throw an internal error instead of returning a user-facing validation message.
Suggested Fix
- Validate incoming requests for expected fields (
messagesvsinput) and return a400 Bad Requestwith a descriptive message rather than500. - Update documentation to clarify the correct parameter format for multimodal input.
Metadata
Metadata
Assignees
Labels
No labels