[KongchangAI]
· 1 min read· 813 words

AI SDK xAI 5.0.32 Fixes Duplicate Citations in Streaming

AI SDK xAI 5.0.32 Fixes Duplicate Citations in Streaming

AI SDK's xAI provider releases 5.0.32, fixing duplicate emission of streaming search citations.

The xAI provider module for AI SDK has released patch version 5.0.32. The core change fixes a defect where each citation was emitted twice when using Web search or X search in streaming responses, so the frontend no longer displays duplicate citation entries. The fix corresponds to commit 0eb8de6, ensuring each citation is sent only once. The version also synchronizes the internal dependency `@ai-sdk/provider-utils` to 5.0.70 to keep underlying utility functions consistent and avoid compatibility issues. As a patch version, upgrade risk is low; projects using search features are advised to upgrade directly and perform a quick verification in streaming search scenarios; projects not using search features can also follow along to keep the dependency chain clean.

rss source: @ai-sdk/xai@5.0.32

The xAI provider module for AI SDK has released version 5.0.32, a patch update that primarily addresses a defect affecting the streaming response experience: when using Web search or X search features, citations are emitted twice.

Core Fix: Deduplicating Streaming Search Citations

The key commit in this update (0eb8de6) explicitly fixes the issue: fix(xai): stop emitting each citation twice when streaming responses with web or X search. In streaming scenarios, search result citations returned by the model were previously emitted twice, causing the frontend to display duplicate citation entries—harming readability and potentially interfering with downstream processing of citation data.

The fix ensures each citation is sent only once, making the citation list in streaming output match expectations. For developers building search-augmented applications with AI SDK, this is a change that directly improves output quality.

AI SDK and Provider Architecture: @ai-sdk/xai mentioned in the article is one of the official provider modules of Vercel AI SDK. AI SDK uses a layered design: the core layer (the ai package) provides unified interfaces like streamText and generateText, while each model vendor (such as xAI, OpenAI, Anthropic) integrates through independent provider packages. Each provider is responsible for translating AI SDK's unified calls into the vendor API's request format and normalizing the raw responses (including text deltas, tool calls, citations, etc.) into AI SDK's standard streaming events. Therefore, issues like "citations being emitted twice" often originate in the provider's response parsing and event emission logic, not the model itself. Fixes only need to be made at the provider layer, without affecting upper-layer application code.

Streaming Responses and Citations: Streaming responses refer to the model returning content incrementally via SSE or data streams as it generates, allowing the frontend to render in real time. When Web search or X search is enabled, xAI's response includes citation information alongside the text, indicating which webpage or post a particular part of the answer comes from. AI SDK emits these citations as independent streaming events for the frontend to display a source list. If the same citation is emitted twice, the frontend will render duplicate entries; for scenarios that programmatically consume citation data, it may also cause errors in counting or deduplication logic.

Dependency Sync Update

In addition to the citation fix, this version also synchronizes internal dependencies, including @ai-sdk/provider-utils@5.0.70. Such dependency updates typically include optimizations or compatibility adjustments to underlying utility functions. Although the release notes do not elaborate, keeping dependency versions consistent helps avoid potential compatibility issues.

The Role of @ai-sdk/provider-utils: This is a shared utility package in the AI SDK ecosystem that encapsulates low-level capabilities common to all providers, such as streaming response parsing and chunking, JSON and SSE event parsing, error normalization, retry and request header handling, etc. All provider packages (including @ai-sdk/xai) depend on it, so its version updates may affect behavioral consistency across all providers. Syncing this dependency to 5.0.70 typically means @ai-sdk/xai uses the corrected utility functions or type definitions from that version, avoiding parsing discrepancies caused by version mismatches. In the npm ecosystem, provider packages generally declare provider-utils as a compatible range dependency; locking to the same version helps with reproducibility and troubleshooting.

Impact on Developers

If you are using @ai-sdk/xai with Web search or X search enabled, upgrading to 5.0.32 will immediately eliminate the duplicate citation issue. As a patch version, the upgrade risk is low, and direct updating is recommended.

For projects not yet using search features, this update is still worth following to keep the dependency chain clean and ensure stability of future features.

How to Upgrade

Simply install the latest version via your package manager:

npm install @ai-sdk/xai@5.0.32

Or update using pnpm, yarn, or other tools. After upgrading, it is recommended to perform a quick verification in a streaming search scenario to confirm citations are no longer duplicated.

Summary

5.0.32 is a targeted fix release that resolves the real-world issue of duplicate citations in streaming search and synchronizes underlying dependencies. For AI applications using xAI search capabilities, this is a recommended minor version upgrade.

One-line Summary

AI SDK's xAI provider releases 5.0.32, fixing duplicate emission of streaming search citations.

Paragraph Summary

The xAI provider module for AI SDK has released patch version 5.0.32. The core change fixes a defect where each citation was emitted twice when using Web search or X search in streaming responses, so the frontend no longer displays duplicate citation entries. The fix corresponds to commit 0eb8de6, ensuring each citation is sent only once. The version also synchronizes the internal dependency @ai-sdk/provider-utils to 5.0.70 to keep underlying utility functions consistent and avoid compatibility issues. As a patch version, upgrade risk is low; projects using search features are advised to upgrade directly and perform a quick verification in streaming search scenarios; projects not using search features can also follow along to keep the dependency chain clean.

#AI SDK#xAI#streaming citations#duplicate citations fix#provider-utils
Share:

Related articles