Skip to main content

Module pipeline

Module pipeline 

Source
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§

AppendStage
Appends a fixed string (e.g. a context suffix or citation block) to the input.
LanguageDetectStage
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.
PipelineBuilder
Fluent builder for constructing a Pipeline.
PipelineResult
The result of a successful Pipeline::run call.
PipelineStats
Timing and length statistics for a single Pipeline::run call.
PrependStage
Prepends a fixed string (e.g. a system-prompt prefix) to the input.
RegexReplaceStage
Performs a regex substitution on the input.
TrimStage
Strips leading and trailing ASCII whitespace from the input.
TruncateStage
Truncates the input to at most max_chars characters, breaking at the last word boundary that fits within the limit.

Enums§

PipelineError
Errors produced by pipeline stages.

Traits§

PipelineStage
A single processing stage in a Pipeline.