fix: preserve Vercel text content metadata#5710
Open
he-yufeng wants to merge 1 commit into
Open
Conversation
ea8ec90 to
ff4c964
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TextContent.metadatawhen dumping user prompt text into VercelTextUIPart.provider_metadataTextContentwhen loading Vercel UI messagesThis addresses the Vercel AI adapter path described in #5679. I left the AG-UI path alone here because its text input content type does not appear to have an equivalent metadata field to round-trip through.
To verify
PYTHONUTF8=1 uv run ruff check pydantic_ai_slim\pydantic_ai\ui\vercel_ai\_adapter.py tests\test_vercel_ai.pyPYTHONUTF8=1 uv run pytest tests\test_vercel_ai.py -k "text_content_metadata_roundtrip or convert_user_prompt_part_text_content" -qPYTHONUTF8=1 uv run pyright pydantic_ai_slim\pydantic_ai\ui\vercel_ai\_adapter.py tests\test_vercel_ai.py