Expand description
§cognis-core
v2-beta foundation: typed Runnable<I, O> trait + supporting primitives.
Top-level modules:
runnable— theRunnable<I, O>trait andRunnableConfig.runnable_ext— fluent.pipe(),.with_retry(), etc. on any runnable.message— typed chat messages.stream—Eventtaxonomy,Observer,RunnableStream,EventStream.error—CognisError,Result,InterruptKind.extensions— typed key-value bag (tower::Extensions-style).prompts— typed prompt templates.output_parsers— typed parsers fromStringto a target type.compose—Pipe,Parallel,Branch,Lambda,Each,Passthrough.wrappers—Retry,Fallback,Timeout,Cache.
Re-exports§
pub use callbacks::BuiltHandler;pub use callbacks::CallbackHandler;pub use callbacks::CallbackManager;pub use callbacks::HandlerBuilder;pub use callbacks::HandlerObserver;pub use content::base64_decode;pub use content::base64_encode;pub use content::image_source_from_path;pub use content::mime_from_path;pub use content::AudioSource;pub use content::ContentPart;pub use content::ImageSource;pub use error::CognisError;pub use error::InterruptKind;pub use error::Result;pub use extensions::Extensions;pub use json_merge::deep_merge_json;pub use message::merge_message_runs;pub use message::message_from_chunks;pub use message::trim_messages;pub use message::trim_messages_custom;pub use message::AiChunk;pub use message::AiMessage;pub use message::HumanChunk;pub use message::HumanMessage;pub use message::Message;pub use message::MessageChunk;pub use message::RemoveMessage;pub use message::SystemChunk;pub use message::SystemMessage;pub use message::ToolCall;pub use message::ToolCallChunk;pub use message::ToolChunk;pub use message::ToolMessage;pub use message::TrimStrategy;pub use runnable::Runnable;pub use runnable::RunnableConfig;pub use runnable_ext::RunnableExt;pub use security::is_public_unicast;pub use serialization::Loader;pub use serialization::RunnableDefinition;pub use serialization::Serializable;pub use stream::Event;pub use stream::EventStream;pub use stream::Observer;pub use stream::RunnableStream;pub use tokenizer::CharTokenizer;pub use tokenizer::FnTokenizer;pub use tokenizer::Tokenizer;pub use schemars;
Modules§
- callbacks
- Typed callback-handler taxonomy. A higher-level alternative to the
flat
crate::Observertrait — handlers receive typed lifecycle calls (on_chain_start,on_llm_token,on_tool_end, …) instead of a single&Eventenum match. - compose
- Composition primitives for
Runnable. - content
- Multimodal content parts.
- error
- Errors for the cognis framework. Operational metadata (
is_retryable,retry_delay,category) lets retry/fallback middleware consume errors without sniffing strings. - extensions
- A typed key-value container, keyed by
TypeId. Inspired bytower::Extensions/axum::Extension. Use this when a struct needs to carry arbitrary plugin-supplied data without baking those types into its public surface. - json_
merge - Deep-merge two
serde_json::Values. - message
- Message types for LLM conversations.
- output_
parsers - Typed parsers that convert LLM string output into structured values.
- prelude
- Common imports for v2 user code.
- prompts
- Typed prompt templates.
- runnable
- The unified
Runnable<I, O>trait + per-call configuration. - runnable_
ext - Fluent extension methods for any
Runnable. - security
- Security utilities — primitives intentionally narrow.
- serialization
- Minimal Runnable serialization layer.
- stream
- Streaming primitives for cognis: token-output streams and structured event streams.
- tokenizer
- Pluggable token counting trait.
- wrappers
- Resilience and policy wrappers for any
Runnable.
Macros§
- schema_
for - Generates a
RootSchemafor the given type using default settings.
Traits§
- Json
Schema - A type which can be described as a JSON Schema document.