Skip to main content

entelix_runnable/
lib.rs

1//! # entelix-runnable
2//!
3//! Composition contract for entelix (invariant 7). Defines
4//! `Runnable<I, O>` and the universal `.pipe()` connector —
5//! `Sequence`, `Parallel`, `Router`, `Lambda`, `Passthrough`, plus the
6//! type-erased `AnyRunnable` for dynamic dispatch (F12 mitigation).
7//!
8//! ## Composition surface
9//!
10//! Every adapter on `RunnableExt` returns a concrete `Runnable<I, O>`
11//! type — chains stay zero-cost in the steady state, with boxing only
12//! at the explicit `erase()` boundary. The standard adapters:
13//!
14//! - `pipe(next)` — sequence two runnables
15//! - `with_retry(policy)` — retry transient errors
16//! - `with_fallbacks(others)` — ordered fallbacks on transient errors
17//! - `map(fn)` — pure synchronous output transform
18//! - `with_config(fn)` — branch-local `ExecutionContext` mutation
19//! - `with_timeout(duration)` — wall-clock deadline override
20//! - `stream_with(input, mode, ctx)` — convenience streaming entry
21
22#![cfg_attr(docsrs, feature(doc_cfg))]
23#![doc(html_root_url = "https://docs.rs/entelix-runnable/0.5.3")]
24#![deny(missing_docs)]
25
26mod adapter;
27mod any_runnable;
28mod chat;
29mod configured;
30mod ext;
31mod fallback;
32mod lambda;
33mod mapping;
34mod parallel;
35mod parser;
36mod passthrough;
37mod retrying;
38mod router;
39mod runnable;
40mod sequence;
41pub mod stream;
42mod structured;
43mod timed;
44
45pub use adapter::ToolToRunnableAdapter;
46pub use any_runnable::{AnyRunnable, AnyRunnableHandle, erase};
47pub use configured::Configured;
48pub use ext::RunnableExt;
49pub use fallback::Fallback;
50pub use lambda::RunnableLambda;
51pub use mapping::Mapping;
52pub use parallel::RunnableParallel;
53pub use parser::JsonOutputParser;
54pub use passthrough::RunnablePassthrough;
55pub use retrying::Retrying;
56pub use router::RunnableRouter;
57pub use runnable::Runnable;
58pub use sequence::RunnableSequence;
59pub use stream::{BoxStream, DebugEvent, RunnableEvent, StreamChunk, StreamMode};
60pub use structured::{ChatModelExt, StructuredOutputAdapter};
61pub use timed::Timed;