generated from coulomb/repo-seed
Copy markitect.llm module into standalone llm_connect package. All markitect.* imports replaced with llm_connect.* equivalents. LLMError base class inlined (no markitect.exceptions dependency). Verified: from llm_connect import create_adapter works. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
68 lines
2.0 KiB
Python
68 lines
2.0 KiB
Python
"""
|
|
llm-connect — Pluggable LLM adapters.
|
|
|
|
Provides concrete :class:`LLMAdapter` implementations backed by
|
|
OpenRouter (HTTP), Gemini, OpenAI, and Claude Code CLI (subprocess).
|
|
|
|
Quick start::
|
|
|
|
from llm_connect import create_adapter
|
|
|
|
adapter = create_adapter("openrouter", model="anthropic/claude-sonnet-4")
|
|
response = adapter.execute_prompt(prompt, run_config)
|
|
"""
|
|
|
|
from llm_connect.models import RunConfig, LLMResponse
|
|
from llm_connect.adapter import LLMAdapter, MockLLMAdapter, ErrorLLMAdapter
|
|
from llm_connect.factory import create_adapter
|
|
from llm_connect.openrouter import OpenRouterAdapter
|
|
from llm_connect.claude_code import ClaudeCodeAdapter
|
|
from llm_connect.gemini import GeminiAdapter
|
|
from llm_connect.openai import OpenAIAdapter
|
|
from llm_connect.config import LLMConfig, load_config
|
|
from llm_connect.exceptions import (
|
|
LLMError,
|
|
LLMConfigurationError,
|
|
LLMAPIError,
|
|
LLMRateLimitError,
|
|
LLMTimeoutError,
|
|
LLMSubprocessError,
|
|
)
|
|
from llm_connect.embedding_adapter import EmbeddingAdapter
|
|
from llm_connect.embedding_openai import OpenAICompatibleEmbeddingAdapter
|
|
from llm_connect.embedding_cache import EmbeddingCache
|
|
from llm_connect.embedding_factory import create_embedding_adapter
|
|
from llm_connect.similarity import (
|
|
cosine_similarity,
|
|
similarity_matrix,
|
|
find_similar_pairs,
|
|
)
|
|
|
|
__all__ = [
|
|
"RunConfig",
|
|
"LLMResponse",
|
|
"LLMAdapter",
|
|
"MockLLMAdapter",
|
|
"ErrorLLMAdapter",
|
|
"create_adapter",
|
|
"OpenRouterAdapter",
|
|
"ClaudeCodeAdapter",
|
|
"GeminiAdapter",
|
|
"OpenAIAdapter",
|
|
"LLMConfig",
|
|
"load_config",
|
|
"LLMError",
|
|
"LLMConfigurationError",
|
|
"LLMAPIError",
|
|
"LLMRateLimitError",
|
|
"LLMTimeoutError",
|
|
"LLMSubprocessError",
|
|
"EmbeddingAdapter",
|
|
"OpenAICompatibleEmbeddingAdapter",
|
|
"EmbeddingCache",
|
|
"create_embedding_adapter",
|
|
"cosine_similarity",
|
|
"similarity_matrix",
|
|
"find_similar_pairs",
|
|
]
|