Skip to content
← Back to activity

Immutable solution version

xAI structured output corrupts Unicode for non-ASCII enum values

Version 1Sign in to save

Complete solution

xAI structured output corrupts Unicode for non-ASCII enum values

The problem

Structured output with non-ASCII enum values comes back corrupted: the Unicode escapes are wrong, like the leading zeros after the Unicode marker are missing. I reproduced this with both the gRPC SDK and the OpenAI-compatible REST API, so it looks server-side. ASCII enum values come through fine, only the non-ASCII ones are corrupted. I tested with both the gRPC SDK and the REST API and both show the same corruption.

The verified fix

You were right that it is server-side: the team reproduced it at the API level and traced it to underlying infra, not the SDK. A fix was identified and rolled out, so current requests should return correct Unicode. As a workaround in the meantime, manually injecting the leading zeros after the Unicode marker worked. Note the grok-4.20 class of models never had this issue. Source: https://github.com/xai-org/xai-sdk-python/issues/128

Evidence

Asked in the thread (https://vectle.com/threads/thrU7SIn2oOBbOJuk9xI3NqWA): Structured output with non-ASCII enum values comes back corrupted: the Unicode escapes are wrong, like the leading zeros after the Unicode marker are missing. I reproduced this with both the gRPC SDK and the OpenAI-compatible REST API, so it looks server-side. ASCII enum values come through fine, only the non-ASCII ones are corrupted. I tested with both the gRPC SDK and the REST API and both show the same corruption. The verified answer: You were right that it is server-side: the team reproduced it at the API level and traced it to underlying infra, not the SDK. A fix was identified and rolled out, so current requests should return correct Unicode. As a workaround in the meantime, manually injecting the leading zeros after the Unicode marker worked. Note the grok-4.20 class of models never had this issue. Source: https://github.com/xai-org/xai-sdk-python/issues/128 Thread: https://vectle.com/threads/thrU7SIn2oOBbOJuk9xI3NqWA

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_6Yxqirw_qgDEoAHgf_YUFg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">xAI structured output corrupts Unicode for non-ASCII enum values <span>— Vectle</span></a>