Workflows
The workflow layer orchestrates the pluggable pipeline by composing extractors, gatherers, verifiers, and formatters into a complete evaluation workflow.
WorkflowConfig
truthfulness_evaluator.llm.workflows.config.WorkflowConfig
dataclass
Configuration for a truthfulness evaluation workflow.
Bundles ready-to-use strategy instances with workflow-level settings. Callers construct strategy instances with desired config, then hand them to WorkflowConfig. The builder plugs them into graph nodes.
Source code in src/truthfulness_evaluator/llm/workflows/config.py
Usage Example:
from truthfulness_evaluator.llm.workflows.config import WorkflowConfig
from truthfulness_evaluator import SimpleExtractor
from truthfulness_evaluator import WebSearchGatherer
from truthfulness_evaluator import ConsensusVerifier
from truthfulness_evaluator import MarkdownFormatter
config = WorkflowConfig(
extractor=SimpleExtractor(),
gatherer=WebSearchGatherer(max_results=5),
verifier=ConsensusVerifier(model_names=["gpt-4o", "claude-3-5-sonnet-20241022"]),
formatter=MarkdownFormatter()
)
WorkflowRegistry
truthfulness_evaluator.llm.workflows.registry.WorkflowRegistry
Registry for workflow configurations.
Provides: - Built-in presets (external, internal, scientific, etc.) - Runtime registration for custom workflows - Entry-point discovery for third-party plugins
Source code in src/truthfulness_evaluator/llm/workflows/registry.py
get(name)
classmethod
Get a workflow configuration by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
Workflow name. |
required |
Returns:
| Type | Description |
|---|---|
WorkflowConfig
|
The WorkflowConfig. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If workflow name is not registered. |
Source code in src/truthfulness_evaluator/llm/workflows/registry.py
list_workflows()
classmethod
List all registered workflows with descriptions.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
Dict of name -> description. |
Source code in src/truthfulness_evaluator/llm/workflows/registry.py
register(name, config, *, override=False)
classmethod
Register a workflow configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
Unique workflow name. |
required |
config |
WorkflowConfig
|
The workflow configuration. |
required |
override |
bool
|
If True, allow overriding existing registrations. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If name is already registered and override is False. |
Source code in src/truthfulness_evaluator/llm/workflows/registry.py
Usage Example:
from truthfulness_evaluator.llm.workflows.registry import WorkflowRegistry
registry = WorkflowRegistry()
# Get a preset workflow
config = registry.get_workflow("external")
# List all available workflows
workflows = registry.list_workflows()
print(workflows) # ["external", "full", "quick", "internal"]
WorkflowState
truthfulness_evaluator.llm.workflows.state.WorkflowState
Bases: TypedDict
Unified state for all truthfulness evaluation workflows.
The core fields are used by every workflow. The extensions field
provides a namespace for strategy-specific state (e.g., claim
classifications for internal verification workflows).
Source code in src/truthfulness_evaluator/llm/workflows/state.py
Usage Note: WorkflowState is the unified state TypedDict used by LangGraph workflows. It tracks the document, extracted claims, evidence, verification results, and final report throughout the pipeline.
Presets
The workflows.presets module provides pre-configured workflows for common use cases:
| Preset | Description | Extractor | Gatherer | Verifier | Formatter |
|---|---|---|---|---|---|
external |
Web-based verification with multi-model consensus | Simple | WebSearch | Consensus (3 models) | Markdown |
full |
Comprehensive verification with web + filesystem | Simple | Composite (web + filesystem) | Consensus (3 models) | Markdown |
quick |
Fast single-model verification | Simple | WebSearch (limited) | Single model | Markdown |
internal |
Code-documentation alignment | Simple | Filesystem | Internal (AST/config) | Markdown |
Usage Example:
from truthfulness_evaluator.llm.workflows.presets import create_external_config
config = create_external_config()
For the internal preset, you must provide the codebase root path: