fix: preserve dynamic custom provider semantics
maintainer edit: treat arbitrary custom provider names as direct OpenAI-compatible providers, validate their api_type consistently, and avoid Pydantic instance-field warnings in fallback routing.
This commit is contained in:
1 parent
e9e1489cee
commit
68c6844c0b
4 files changed
+71
-14
No files matched your search
@@ -8,7 +8,7 @@ from pathlib import Path
|
||||
from nanobot.config.schema import Config, InlineFallbackConfig, ModelPresetConfig
|
||||
from nanobot.providers.base import LLMProvider
|
||||
from nanobot.providers.fallback_provider import FallbackProvider
|
||||
from nanobot.providers.registry import find_by_name
|
||||
from nanobot.providers.registry import create_dynamic_spec, find_by_name
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -41,6 +41,8 @@ def _make_provider_core(
|
||||
provider_name = config.get_provider_name(model, preset=resolved)
|
||||
p = config.get_provider(model, preset=resolved)
|
||||
spec = find_by_name(provider_name) if provider_name else None
|
||||
if provider_name and not spec and p:
|
||||
spec = create_dynamic_spec(provider_name)
|
||||
if spec and spec.is_transcription_only:
|
||||
raise ValueError(f"Provider '{provider_name}' only supports transcription.")
|
||||
backend = spec.backend if spec else "openai_compat"
|
||||
|
||||
Reference in new issue
Block a user