Files
llm-connect/llm_connect/__init__.py
tegwick c11c6afa3f
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
Implement-LLM-WP-0005-cost-model-estimators
2026-05-19 05:02:20 +02:00

128 lines
3.5 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.adapter import ErrorLLMAdapter, LLMAdapter, MockLLMAdapter
from llm_connect.claude_code import ClaudeCodeAdapter
from llm_connect.config import LLMConfig, load_config
from llm_connect.costs import CostEstimate, CostModel, estimate_cost
from llm_connect.embedding_adapter import EmbeddingAdapter
from llm_connect.embedding_cache import EmbeddingCache
from llm_connect.embedding_factory import create_embedding_adapter
from llm_connect.embedding_openai import OpenAICompatibleEmbeddingAdapter
from llm_connect.exceptions import (
LLMAPIError,
LLMBudgetExceededError,
LLMConfigurationError,
LLMError,
LLMRateLimitError,
LLMSubprocessError,
LLMTimeoutError,
)
from llm_connect.factory import create_adapter
from llm_connect.gemini import GeminiAdapter
from llm_connect.grading import (
BaselineGrader,
EmbeddingSimilarityJudge,
ExactMatchJudge,
GradingResult,
Judge,
LLMJudge,
PairedGrader,
)
from llm_connect.models import BudgetTracker, LLMResponse, RunConfig
from llm_connect.openai import OpenAIAdapter
from llm_connect.openrouter import OpenRouterAdapter
from llm_connect.problem_classes import (
ChunkSummarizationProblemClass,
EntityExtractionProblemClass,
JudgeEvalProblemClass,
Observation,
ProblemClass,
ProblemClassRegistry,
RelationExtractionProblemClass,
ReportSynthesisProblemClass,
TokenEstimate,
default_problem_class_registry,
)
from llm_connect.quality import QualityLedger, QualityObservation, is_stale
from llm_connect.rates import ModelRate, ModelRateRegistry
from llm_connect.routing import AdaptiveRoutingPolicy, RoutingPolicy, RoutingRule
from llm_connect.server import LLMServer
from llm_connect.shadowing import ShadowingAdapter
from llm_connect.similarity import (
cosine_similarity,
find_similar_pairs,
similarity_matrix,
)
__all__ = [
"RunConfig",
"LLMResponse",
"BudgetTracker",
"LLMAdapter",
"MockLLMAdapter",
"ErrorLLMAdapter",
"create_adapter",
"OpenRouterAdapter",
"ClaudeCodeAdapter",
"GeminiAdapter",
"OpenAIAdapter",
"LLMConfig",
"load_config",
"LLMError",
"LLMConfigurationError",
"LLMAPIError",
"LLMRateLimitError",
"LLMTimeoutError",
"LLMSubprocessError",
"LLMBudgetExceededError",
"EmbeddingAdapter",
"OpenAICompatibleEmbeddingAdapter",
"EmbeddingCache",
"create_embedding_adapter",
"QualityObservation",
"QualityLedger",
"is_stale",
"GradingResult",
"Judge",
"BaselineGrader",
"ExactMatchJudge",
"EmbeddingSimilarityJudge",
"LLMJudge",
"PairedGrader",
"cosine_similarity",
"similarity_matrix",
"find_similar_pairs",
"RoutingPolicy",
"RoutingRule",
"AdaptiveRoutingPolicy",
"ShadowingAdapter",
"LLMServer",
"ModelRate",
"ModelRateRegistry",
"CostEstimate",
"CostModel",
"estimate_cost",
"TokenEstimate",
"Observation",
"ProblemClass",
"ProblemClassRegistry",
"default_problem_class_registry",
"ChunkSummarizationProblemClass",
"EntityExtractionProblemClass",
"RelationExtractionProblemClass",
"JudgeEvalProblemClass",
"ReportSynthesisProblemClass",
]