feat(context): implement model adapters for Claude and OpenAI (#83)
Phase 5 of Context Management Engine - Model Adapters: - Add ModelAdapter abstract base class with model matching - Add DefaultAdapter for unknown models (plain text) - Add ClaudeAdapter with XML-based formatting: - <system_instructions> for system context - <reference_documents>/<document> for knowledge - <conversation_history>/<message> for chat - <tool_results>/<tool_result> for tool outputs - XML escaping for special characters - Add OpenAIAdapter with markdown formatting: - ## headers for sections - ### Source headers for documents - **ROLE** bold labels for conversation - Code blocks for tool outputs - Add get_adapter() factory function for model selection Tests: 33 new tests, 256 total context tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,15 @@ from .compression import (
|
||||
TruncationStrategy,
|
||||
)
|
||||
|
||||
# Adapters
|
||||
from .adapters import (
|
||||
ClaudeAdapter,
|
||||
DefaultAdapter,
|
||||
get_adapter,
|
||||
ModelAdapter,
|
||||
OpenAIAdapter,
|
||||
)
|
||||
|
||||
# Prioritization
|
||||
from .prioritization import (
|
||||
ContextRanker,
|
||||
@@ -110,6 +119,12 @@ from .types import (
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Adapters
|
||||
"ClaudeAdapter",
|
||||
"DefaultAdapter",
|
||||
"get_adapter",
|
||||
"ModelAdapter",
|
||||
"OpenAIAdapter",
|
||||
# Assembly
|
||||
"ContextPipeline",
|
||||
"PipelineMetrics",
|
||||
|
||||
Reference in New Issue
Block a user