← ClaudeAtlas

ai-subsystem-quickstartlisted

Use when setting up the AI subsystem — LLM clients, RAG pipelines, agents, memory, or MCP servers in the Lexigram framework
dbtinoy-/lexigram-framework-skills · ★ 1 · AI & Automation · score 72
Install: claude install-skill dbtinoy-/lexigram-framework-skills
# AI Subsystem Quickstart ## Overview Lexigram's AI stack is modular: 15+ `lexigram-ai-*` packages wired through `AIModule`. All follow contract-first DI — inject `*Protocol`, swap backends via config. See `docs/guides/ai-*.md` for deep dives. ## LLM Client ```python from lexigram.contracts.ai.llm import LLMClientProtocol from lexigram.contracts.ai.llm import ChatMessage, Role class MyService: def __init__(self, llm: LLMClientProtocol): self.llm = llm async def summarize(self, text: str) -> Result[str, AIError]: messages = [ChatMessage(role=Role.USER, content=text)] result = await self.llm.complete(messages) return result.map_sync(lambda r: r.content) ``` ## RAG Pipeline ```python from lexigram.contracts.ai.rag import RAGPipelineProtocol, RAGContext class QAService: def __init__(self, rag: RAGPipelineProtocol): self.rag = rag async def answer(self, question: str) -> Result[str, AIError]: result = await self.rag.execute(RAGContext(query=question)) return result.map_sync(lambda r: r.answer) ``` ## Agents ```python from lexigram.contracts.ai.agents import AgentExecutorProtocol, ToolProtocol class SearchTool(ToolProtocol): @property def name(self) -> str: return "search" @property def description(self) -> str: return "Search the docs" @property def parameters_schema(self) -> dict: return {"type": "object", "properties": {"query": {"type": "string"