Close local release-quality gaps and reconcile workplan status
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a0e332-3365-77c0-8491-084e9ea33ac1
This commit is contained in:
parent
37436bb562
commit
7cd633986e
56 changed files with 462 additions and 237 deletions
|
|
@ -2,14 +2,15 @@
|
|||
Factory for creating LLM adapters by provider name.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Optional, Dict, Any
|
||||
import os
|
||||
from collections.abc import Callable
|
||||
from typing import Any
|
||||
|
||||
from llm_connect.adapter import LLMAdapter
|
||||
from llm_connect.exceptions import LLMConfigurationError
|
||||
|
||||
# Lazy imports to avoid pulling in every adapter at module load time.
|
||||
_PROVIDERS: Dict[str, str] = {
|
||||
_PROVIDERS: dict[str, str] = {
|
||||
"openrouter": "llm_connect.openrouter.OpenRouterAdapter",
|
||||
"claude-code": "llm_connect.claude_code.ClaudeCodeAdapter",
|
||||
"gemini": "llm_connect.gemini.GeminiAdapter",
|
||||
|
|
@ -20,9 +21,9 @@ _PROVIDERS: Dict[str, str] = {
|
|||
|
||||
def create_adapter(
|
||||
provider: str = "openrouter",
|
||||
model: Optional[str] = None,
|
||||
api_key: Optional[str] = None,
|
||||
system_prompt: Optional[str] = None,
|
||||
model: str | None = None,
|
||||
api_key: str | None = None,
|
||||
system_prompt: str | None = None,
|
||||
**kwargs: Any,
|
||||
) -> LLMAdapter:
|
||||
"""Instantiate an :class:`LLMAdapter` for the given *provider*.
|
||||
|
|
@ -52,7 +53,7 @@ def create_adapter(
|
|||
module_path, class_name = fqn.rsplit(".", 1)
|
||||
import importlib
|
||||
mod = importlib.import_module(module_path)
|
||||
cls = getattr(mod, class_name)
|
||||
cls: Callable[..., LLMAdapter] = getattr(mod, class_name)
|
||||
|
||||
if provider in ("openrouter", "gemini", "openai"):
|
||||
return cls(model=model, api_key=api_key, system_prompt=system_prompt, **kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue