feat(07-02): registry-based get_provider(config: ProviderConfig) — D-06
- Rewrites ai/__init__.py with _REGISTRY dict (10 entries) replacing the if/elif chain - get_provider() accepts ProviderConfig (not raw dict), raises ValueError on unknown - Resolves effective values: api_key fallback to "not-needed", model/base_url/context_chars from PROVIDER_DEFAULTS when config fields are empty/zero - SUPPORTS_JSON_MODE lookup sets supports_json_mode on GenericOpenAIProvider instances - AnthropicProvider instantiated without base_url (Plan 03 will widen the ctor) - provider_config.py: context_chars default changed to 0 (sentinel for PROVIDER_DEFAULTS resolution); 8000 default was inconsistent with O(1) factory pattern (Rule 1 fix)
This commit is contained in:
@@ -29,7 +29,7 @@ class ProviderConfig(BaseModel):
|
||||
api_key: str = ""
|
||||
base_url: Optional[str] = None
|
||||
model: str = ""
|
||||
context_chars: int = 8000
|
||||
context_chars: int = 0 # 0 means "unset — use PROVIDER_DEFAULTS in get_provider()"
|
||||
|
||||
|
||||
# Named preset defaults for all 10 supported providers.
|
||||
|
||||
Reference in New Issue
Block a user