Skip to main content

Module llm_backend

Module llm_backend 

Source
Expand description

LLM-based extraction backend (v1.0.75 — G21 + G23 solution)

Default extraction backend. Extracts entities and relationships by invoking an LLM CLI (claude code or codex CLI) in headless mode.

Structs§

AutoFactory
Auto-detect factory — picks CodexFactory when codex is on PATH, ClaudeFactory when claude is on PATH, NullFactory when neither is reachable. This is the v1.0.81 behaviour (implicit preference for codex) made explicit.
ClaudeFactory
Claude CLI factory.
CodexFactory
Codex CLI factory — builds a LlmBackend configured for codex exec.
LlmBackend
LLM-based extraction backend.
LlmExtractorConfig
Configuration for the LLM extractor.
NullFactory
No-op factory — every extraction call returns empty output; every embed call returns an empty vector. Used by --llm-backend=none (zero-dependency mode).

Enums§

LlmBackendKindFactory
LLM backend kind (mirrors cli::LlmBackendChoice).

Traits§

LlmBackendFactory
Factory trait for LLM-based backends. Each implementation knows how to build the right CLI invocation (codex vs claude vs none) from the user-supplied LlmExtractorConfig.

Functions§

detect_available_backend
Resolves the available LLM CLI by probing PATH for codex first, then claude. Returns None if neither is found.
factory_for_choice
Factory dispatcher — converts a CLI enum value into a boxed factory. This is the integration point used by composite_backend.rs and by the 6 commands that consume --llm-backend.