| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
- Transform empty assistant content ("") to null in openai-compatible requests
- Extend empty content filtering to openai-compatible provider
- Filter empty text blocks from tool-result content arrays
- Handle tool outputs with empty text but attachments
- Add placeholder text when tool output is completely empty
- Add comprehensive test coverage for edge cases
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Sorry, something went wrong.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Sorry, something went wrong.
|
The following comment was made by an LLM, it may be inaccurate: Found a potentially related PR: PR #16750: fix(provider): skip empty-text filtering for assistant messages in normalizeMessages
The other PRs found (Databricks provider support, thinking blocks, dangling tool_use blocks) appear to be less directly related to the core issue of empty content handling for bedrock/openai-compatible providers. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Background
When using AWS Bedrock (Anthropic models) through the openai-compatible provider, the API rejects assistant messages that have content: "". This typically occurs when an assistant turn has only tool calls but no text response - the AI SDK serializes the content as an empty string, which Bedrock's API rejects.
Changes
Provider-level transformation (packages/opencode/src/provider/provider.ts):
Message transformation (packages/opencode/src/provider/transform.ts):
Tool output handling (packages/opencode/src/session/message-v2.ts):
Testing
Added comprehensive test coverage in:
All tests verify the transformations work correctly for various edge cases while preserving existing behavior for other providers.