Skip to content

API Reference

Complete reference for every public class, function, and dataclass in Director-AI.

Quick Navigation

Entry Points

Symbol Module Purpose
guard() director_ai Wrap an LLM SDK client with coherence scoring
score() director_ai Score a single prompt/response pair
get_score() director_ai Retrieve last score from on_fail="metadata"

Core Classes

Class Module Purpose
CoherenceScorer director_ai.core.scoring.scorer Dual-entropy coherence scoring engine
StreamingKernel director_ai.core.runtime.streaming Token-level streaming halt
AsyncStreamingKernel director_ai.core.runtime.async_streaming Async variant of StreamingKernel
CoherenceAgent director_ai.core.agent Orchestrator: generator + scorer + kernel
BatchProcessor director_ai.core.runtime.batch Concurrent batch scoring

Knowledge & Retrieval

Class Module Purpose
GroundTruthStore director_ai.core.retrieval.knowledge Key-value fact store (prototype)
VectorGroundTruthStore director_ai.core.retrieval.vector_store Semantic vector store with pluggable backends
VectorBackend director_ai.core.retrieval.vector_store Abstract backend protocol

Configuration

Class Module Purpose
DirectorConfig director_ai.core.config Env var / YAML / profile configuration

Data Types

Class Module Purpose
CoherenceScore director_ai.core.types Score result with H_logical, H_factual, evidence
ReviewResult director_ai.core.types Agent review output
ScoringEvidence director_ai.core.types Retrieved chunks + NLI details
HaltEvidence director_ai.core.types Structured halt reason with evidence
TokenEvent director_ai.core.runtime.streaming Per-token stream event
StreamSession director_ai.core.runtime.streaming Complete stream session state

Interfaces

Interface Purpose
REST Server FastAPI endpoints (/v1/review, /v1/health, /v1/metrics)
gRPC Server Protocol Buffers service (4 RPC methods)
CLI 15 command-line subcommands

Exceptions

Exception Raised When
HallucinationError guard() with on_fail="raise" detects low coherence
KernelHaltError SafetyKernel halts the output stream
ValidationError Invalid configuration or input
DependencyError Required optional package missing

Import Patterns

# Top-level convenience imports
from director_ai import guard, score, get_score
from director_ai import CoherenceScorer, StreamingKernel, CoherenceAgent

# Direct module imports (for type hints and advanced use)
from director_ai.core.config import DirectorConfig
from director_ai.core.types import CoherenceScore, ReviewResult
from director_ai.core.retrieval.vector_store import VectorGroundTruthStore, ChromaBackend
from director_ai.core.runtime.batch import BatchProcessor

# Enterprise (lazy-loaded)
from director_ai.enterprise import TenantRouter, Policy, AuditLogger