feat(providers): add xAI Grok OAuth with capability-gated X Search (#5035)
This commit is contained in:
1 parent
c22efb5f7a
commit
c7393c785e
38 files changed
+3881
-104
No files matched your search
@@ -60,10 +60,10 @@ def _make_provider_core(
|
||||
if spec and spec.is_transcription_only:
|
||||
raise ValueError(f"Provider '{provider_name}' only supports transcription.")
|
||||
backend = spec.backend if spec else "openai_compat"
|
||||
if p and p.proxy and backend not in {"openai_compat", "openai_codex"}:
|
||||
if p and p.proxy and backend not in {"openai_compat", "openai_codex", "xai_grok"}:
|
||||
raise ValueError(
|
||||
f"providers.{provider_name}.proxy is only supported for "
|
||||
"OpenAI-compatible providers and OpenAI Codex."
|
||||
"OpenAI-compatible providers, OpenAI Codex, and xAI Grok."
|
||||
)
|
||||
|
||||
if backend == "azure_openai":
|
||||
@@ -91,6 +91,14 @@ def _make_provider_core(
|
||||
proxy=getattr(p, "proxy", None) if p else None,
|
||||
extra_body=p.extra_body if p else None,
|
||||
)
|
||||
elif backend == "xai_grok":
|
||||
from nanobot.providers.xai_grok_provider import XAIGrokProvider
|
||||
|
||||
provider = XAIGrokProvider(
|
||||
default_model=model,
|
||||
proxy=getattr(p, "proxy", None) if p else None,
|
||||
extra_body=p.extra_body if p else None,
|
||||
)
|
||||
elif backend == "azure_openai":
|
||||
from nanobot.providers.azure_openai_provider import AzureOpenAIProvider
|
||||
|
||||
|
||||
Reference in new issue
Block a user