Skip to main content

Module ai

Module ai 

Source
Expand description

AI runtime modules.

Houses the LLM-touching pieces of the AskPipeline:

  • prompt_template — typed-slot prompt assembly with secret redaction and injection defence (issue #122).
  • ner — opt-in LLM backend for AskPipeline Stage 1 entity extraction with auth gate, response sanitization, and a configurable heuristic fallback (issue #123).

Both modules are pure additions — call-site wiring lives in super::ask_pipeline and is opt-in via ai.ner.backend = "llm" at runtime config time.

Modules§

answer_cache_key
AnswerCacheKey — pure key derivation and TTL policy for the ASK answer cache.
ask_response_envelope
AskResponseEnvelope — pure serializer for the canonical non-streaming ASK JSON response (issue #406, PRD #391).
audit_record_builder
AuditRecordBuilder — pure builder for red_ask_audit rows.
batch_client
Batch embedding client — issue #275.
citation_parser
CitationParser — pure text-to-citations extractor.
cost_guard
CostGuardEvaluator — pure ASK resource-cap policy.
dedup_cache
Embedding dedup cache — issue #277.
determinism_decider
DeterminismDecider — pure resolution of temperature + seed.
explain_plan_builder
ExplainPlanBuilder — pure JSON plan synthesis for EXPLAIN ASK '...'.
grpc_ask_message
GrpcAskMessage — pure builder pinning the typed gRPC AskReply shape (issue #407, PRD #391).
mcp_ask_tool
McpAskTool — pure descriptor + arg parser for exposing ASK '...' as an MCP tool (issue #409, PRD #391).
metrics
AI metrics — issue #280.
ner
LLM-based NER for AskPipeline Stage 1 — issue #123.
pg_wire_ask_row_encoder
PgWireAskRowEncoder — pure encoder that turns an AskResult into the single-row Postgres-wire result set that #408 exposes to psycopg / pgx / JDBC.
prompt_assembler
PromptAssembler — pure composition of (system_prompt, sources, question) → final prompt text (issue #397).
prompt_template
PromptTemplate — typed-slot prompt assembly for the AskPipeline synthesis stage with provider-tier matrix, secret redaction, and injection defence (issue #122, PRD #118).
provider_capabilities
ProviderCapabilityRegistry — pure provider capability lookup.
provider_failover
ProviderFailover — pure ordered-list failover kernel for ASK.
rrf_fuser
RrfFuser — pure Reciprocal Rank Fusion for ASK hybrid retrieval.
sources_fingerprint
SourcesFingerprint — pure stable hash over the retrieved source set.
sse_frame_encoder
SseFrameEncoder — pure Server-Sent Events frame serializer for ASK '...' STREAM over HTTP.
strict_validator
StrictValidator — pure citation validation policy.
text_chunker
Text chunker — issue #277.
transport
Shared async HTTP transport foundation for AI providers.
urn_codec
URN codec for ASK source references (issue #394).