Fix xAI sentiment: use Agent Tools web_search (Live Search deprecated)
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user