Skip to content

fix(clients): avoid empty text parts when encoding OpenAI message content#37

Open
DeNeRATe-cool wants to merge 1 commit intoArtificialAnalysis:mainfrom
DeNeRATe-cool:fix/content-to-openai-empty-assistant
Open

fix(clients): avoid empty text parts when encoding OpenAI message content#37
DeNeRATe-cool wants to merge 1 commit intoArtificialAnalysis:mainfrom
DeNeRATe-cool:fix/content-to-openai-empty-assistant

Conversation

@DeNeRATe-cool
Copy link
Copy Markdown

Summary

This change updates content_to_openai so that an empty string is passed through as "" instead of being wrapped as [{"type": "text", "text": ""}]. Empty string segments inside list content are skipped, and if no parts remain, the result is "".

Background

Assistant turns that only invoke tools often have content="". Some OpenAI-compatible gateways appear to strip empty text fields from content parts, which can leave invalid fragments containing only type and trigger 400 errors. Representing “no visible content” as a plain empty string aligns better with common API usage for assistant messages that include tool_calls.

Thank you for maintaining Stirrup — happy to adjust anything if you would prefer a different approach or additional coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant