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>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""
|
|
markitect.llm — LLM integration adapters for MarkiTect.
|
|
|
|
Provides concrete :class:`LLMAdapter` implementations backed by
|
|
OpenRouter (HTTP) and Claude Code CLI (subprocess).
|
|
|
|
Quick start::
|
|
|
|
from markitect.llm import create_adapter
|
|
|
|
adapter = create_adapter("openrouter", model="anthropic/claude-sonnet-4")
|
|
response = adapter.execute_prompt(prompt, run_config)
|
|
"""
|
|
|
|
from markitect.llm.factory import create_adapter
|
|
from markitect.llm.openrouter import OpenRouterAdapter
|
|
from markitect.llm.claude_code import ClaudeCodeAdapter
|
|
from markitect.llm.gemini import GeminiAdapter
|
|
from markitect.llm.config import LLMConfig, load_config
|
|
from markitect.llm.exceptions import (
|
|
LLMError,
|
|
LLMConfigurationError,
|
|
LLMAPIError,
|
|
LLMRateLimitError,
|
|
LLMTimeoutError,
|
|
LLMSubprocessError,
|
|
)
|
|
|
|
__all__ = [
|
|
"create_adapter",
|
|
"OpenRouterAdapter",
|
|
"ClaudeCodeAdapter",
|
|
"GeminiAdapter",
|
|
"LLMConfig",
|
|
"load_config",
|
|
"LLMError",
|
|
"LLMConfigurationError",
|
|
"LLMAPIError",
|
|
"LLMRateLimitError",
|
|
"LLMTimeoutError",
|
|
"LLMSubprocessError",
|
|
]
|