Fix xAI sentiment: use Agent Tools web_search (Live Search deprecated)
Deploy / lint (push) Successful in 5s
Deploy / test (push) Successful in 31s
Deploy / deploy (push) Successful in 23s

xAI returned 410 — search_parameters/Live Search is retired. Route xAI
through the Responses API web_search tool instead (same path as OpenAI):
- OpenAISentimentProvider parametrized with base_url / tool_type / source
- xAI builds it against https://api.x.ai/v1 with the web_search tool
- Drop the dead Live Search code from the generic compatible provider
- Frontend label: "xAI Grok — web search"

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-13 14:30:45 +02:00
parent 126c3b3c17
commit ffb609d38f
5 changed files with 45 additions and 69 deletions
@@ -102,13 +102,13 @@ class TestBuildProvider:
assert config["base_url"] == "https://api.deepseek.com"
assert config["web_search"] is False
async def test_builds_xai_with_live_search(self, session: AsyncSession):
async def test_builds_xai_via_responses_web_search(self, session: AsyncSession):
await sps.update_sentiment_config(session, provider="xai", api_key="xai-x")
provider = await sps.build_sentiment_provider(session)
assert type(provider).__name__ == "OpenAICompatibleSentimentProvider"
# xAI is wired with Live Search enabled
assert provider._live_search is True
assert provider._extra_body == {"search_parameters": {"mode": "auto", "return_citations": True}}
# xAI grounds via the Responses API web_search tool
assert type(provider).__name__ == "OpenAISentimentProvider"
assert provider._tool_type == "web_search"
assert provider._source == "xai"
config = await sps.get_sentiment_config(session)
assert config["base_url"] == "https://api.x.ai/v1"
assert config["web_search"] is True