feat(llm): add Gemini adapter and process book-1-chapter-05
Add GeminiAdapter calling Google's Generative Language REST API (default model: gemini-2.5-flash). Register "gemini" as third provider in the factory and CLI. Add rate-limit retry with exponential backoff to the pipeline's _call_llm helper. Increase default max_tokens from 2000 to 4096. Process book-1-chapter-05 via Gemini free tier — 1 new entity extracted (necessaries-conveniencies-and-amusements-of-life), 41 existing entities correctly skipped by dedup. Canonical set now at 42 unique entities. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ from markitect.llm.exceptions import LLMConfigurationError
|
||||
_PROVIDERS: Dict[str, str] = {
|
||||
"openrouter": "markitect.llm.openrouter.OpenRouterAdapter",
|
||||
"claude-code": "markitect.llm.claude_code.ClaudeCodeAdapter",
|
||||
"gemini": "markitect.llm.gemini.GeminiAdapter",
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +25,10 @@ def create_adapter(
|
||||
"""Instantiate an :class:`LLMAdapter` for the given *provider*.
|
||||
|
||||
Args:
|
||||
provider: ``"openrouter"`` or ``"claude-code"``.
|
||||
provider: ``"openrouter"``, ``"claude-code"``, or ``"gemini"``.
|
||||
model: Model name (passed to the adapter constructor).
|
||||
api_key: Explicit API key (OpenRouter only).
|
||||
system_prompt: Optional system prompt (OpenRouter only).
|
||||
api_key: Explicit API key (OpenRouter / Gemini).
|
||||
system_prompt: Optional system prompt (OpenRouter / Gemini).
|
||||
**kwargs: Extra keyword arguments forwarded to the adapter.
|
||||
|
||||
Returns:
|
||||
@@ -50,7 +51,7 @@ def create_adapter(
|
||||
mod = importlib.import_module(module_path)
|
||||
cls = getattr(mod, class_name)
|
||||
|
||||
if provider == "openrouter":
|
||||
if provider in ("openrouter", "gemini"):
|
||||
return cls(model=model, api_key=api_key, system_prompt=system_prompt, **kwargs)
|
||||
elif provider == "claude-code":
|
||||
return cls(model=model, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user