Initial release: aircontext
This commit is contained in:
19
scripts/core/backends/base.py
Normal file
19
scripts/core/backends/base.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""Backend interface used by compactor.py."""
|
||||
from __future__ import annotations
|
||||
from typing import Protocol
|
||||
|
||||
|
||||
class CompressionBackend(Protocol):
|
||||
def summarise(self, system_prompt: str, conversation_text: str) -> str: ...
|
||||
|
||||
|
||||
def build_backend(cfg: dict) -> CompressionBackend:
|
||||
backend_cfg = cfg.get("backend") or {}
|
||||
btype = backend_cfg.get("type", "openai_compat")
|
||||
if btype == "openai_compat":
|
||||
from .openai_compat import OpenAICompatibleBackend
|
||||
return OpenAICompatibleBackend(backend_cfg)
|
||||
if btype == "anthropic_native":
|
||||
from .anthropic_native import AnthropicNativeBackend
|
||||
return AnthropicNativeBackend(backend_cfg)
|
||||
raise ValueError(f"Unsupported backend.type: {btype!r}")
|
||||
Reference in New Issue
Block a user