Expand description
§Prompt Pipeline
A composable, ordered sequence of text-transformation stages. Each stage
receives the previous stage’s output as its input. Stages are async and
may be composed with PipelineBuilder.
§Example
use tokio_prompt_orchestrator::pipeline::{PipelineBuilder, TrimStage, TruncateStage};
let pipeline = PipelineBuilder::new()
.add(TrimStage)
.add(TruncateStage { max_chars: 100 })
.build();
let result = pipeline.run(" hello world ".to_string()).await.unwrap();
assert_eq!(result.output, "hello world");Structs§
- Append
Stage - Appends a fixed string (e.g. a context suffix or citation block) to the input.
- Language
Detect Stage - Detects whether the text is predominantly ASCII/Latin script or uses other
Unicode scripts, then prepends a
[lang:en]or[lang:other]tag. - Pipeline
- An ordered sequence of
PipelineStages. - Pipeline
Builder - Fluent builder for constructing a
Pipeline. - Pipeline
Result - The result of a successful
Pipeline::runcall. - Pipeline
Stats - Timing and length statistics for a single
Pipeline::runcall. - Prepend
Stage - Prepends a fixed string (e.g. a system-prompt prefix) to the input.
- Regex
Replace Stage - Performs a regex substitution on the input.
- Trim
Stage - Strips leading and trailing ASCII whitespace from the input.
- Truncate
Stage - Truncates the input to at most
max_charscharacters, breaking at the last word boundary that fits within the limit.
Enums§
- Pipeline
Error - Errors produced by pipeline stages.
Traits§
- Pipeline
Stage - A single processing stage in a
Pipeline.