Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Stage 1 — Decouple:
- Move RunConfig + LLMResponse to markitect/llm/models.py (canonical)
- Move LLMAdapter + Mock/ErrorLLMAdapter to markitect/llm/adapter.py
- markitect/prompts/execution/models.py and llm_adapter.py become re-export shims
- All 4 adapters + factory.py updated to import from markitect.llm.*
- Parameterize app_name in toml_config.py (resolve_llm, get_default_layers,
get_preference_layers): paths and env var now derived from app_name arg
- Add tests/test_llm_isolation.py: 7 isolation + backward-compat tests
Stage 2 — Extract:
- Standalone llm-connect package created at ~/llm-connect/
- All 18 llm files copied; markitect.* imports replaced with llm_connect.*
- LLMError base inlined in llm_connect/exceptions.py (no markitect dep)
- llm-connect installed into markitect-venv; declared in pyproject.toml
Smoke test: markitect llm-check succeeds (live Gemini API call).
Backward compat: markitect.prompts.execution.{models,llm_adapter} still work.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
68 lines
2.0 KiB
Python
68 lines
2.0 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.models import RunConfig, LLMResponse
|
|
from markitect.llm.adapter import LLMAdapter, MockLLMAdapter, ErrorLLMAdapter
|
|
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.openai import OpenAIAdapter
|
|
from markitect.llm.config import LLMConfig, load_config
|
|
from markitect.llm.exceptions import (
|
|
LLMError,
|
|
LLMConfigurationError,
|
|
LLMAPIError,
|
|
LLMRateLimitError,
|
|
LLMTimeoutError,
|
|
LLMSubprocessError,
|
|
)
|
|
from markitect.llm.embedding_adapter import EmbeddingAdapter
|
|
from markitect.llm.embedding_openai import OpenAICompatibleEmbeddingAdapter
|
|
from markitect.llm.embedding_cache import EmbeddingCache
|
|
from markitect.llm.embedding_factory import create_embedding_adapter
|
|
from markitect.llm.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",
|
|
]
|