Skip to content

fix: preserve Vercel text content metadata#5710

Open
he-yufeng wants to merge 1 commit into
pydantic:mainfrom
he-yufeng:fix/vercel-text-content-metadata
Open

fix: preserve Vercel text content metadata#5710
he-yufeng wants to merge 1 commit into
pydantic:mainfrom
he-yufeng:fix/vercel-text-content-metadata

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

  • preserves TextContent.metadata when dumping user prompt text into Vercel TextUIPart.provider_metadata
  • restores that metadata back to TextContent when loading Vercel UI messages
  • adds a focused round-trip regression test

This 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.py
  • PYTHONUTF8=1 uv run pytest tests\test_vercel_ai.py -k "text_content_metadata_roundtrip or convert_user_prompt_part_text_content" -q
  • PYTHONUTF8=1 uv run pyright pydantic_ai_slim\pydantic_ai\ui\vercel_ai\_adapter.py tests\test_vercel_ai.py

@github-actions github-actions Bot added size: S Small PR (≤100 weighted lines) bug Report that something isn't working, or PR implementing a fix labels May 28, 2026
@he-yufeng he-yufeng force-pushed the fix/vercel-text-content-metadata branch from ea8ec90 to ff4c964 Compare May 28, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Report that something isn't working, or PR implementing a fix size: S Small PR (≤100 weighted lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant