Skip to main content

Crate synaptic_core

Crate synaptic_core 

Source

Structs§

AIMessageChunk
A streaming chunk from an AI model response. Supports merge via +/+= operators and conversion to Message via into_message().
ChatRequest
A request to a chat model containing messages, optional tool definitions, and tool choice configuration.
ChatResponse
A response from a chat model containing the AI message and optional token usage statistics.
ContextAwareToolAdapter
Wrapper that adapts a ContextAwareTool into a standard Tool.
Entrypoint
An entrypoint wrapping an async function as a runnable workflow.
EntrypointConfig
Configuration for an #[entrypoint]-decorated function.
InputTokenDetails
Detailed breakdown of input token usage.
InvalidToolCall
A tool call that failed to parse correctly.
Item
A stored item in the key-value store.
ModelProfile
Describes a model’s capabilities and limits.
OutputTokenDetails
Detailed breakdown of output token usage.
RunnableConfig
Runtime configuration passed through runnable chains, including tags, metadata, concurrency limits, and run identification.
Runtime
Graph execution runtime context passed to nodes and middleware.
RuntimeAwareToolAdapter
Adapter that wraps a RuntimeAwareTool into a standard Tool.
TokenUsage
ToolCall
Represents a tool invocation requested by an AI model, with an ID, function name, and JSON arguments.
ToolCallChunk
A partial tool call chunk received during streaming.
ToolContext
Context passed to tools during graph execution.
ToolDefinition
Schema definition for a tool, including its name, description, and JSON Schema for parameters.
ToolRuntime
Tool execution runtime context.

Enums§

ContentBlock
A block of content within a message, supporting multimodal inputs.
Message
Represents a chat message. Tagged enum with System, Human, AI, and Tool variants.
RunEvent
Lifecycle events emitted during agent execution, used by CallbackHandler implementations.
SynapticError
Unified error type for the Synaptic framework with variants covering all subsystems.
ToolChoice
Controls how the model selects tools: Auto, Required, None, or a Specific named tool.
TrimStrategy
Strategy for trimming messages.

Traits§

CallbackHandler
Handler for lifecycle events during agent execution. Receives RunEvent notifications at each stage.
ChatModel
The core trait for language model providers. Implementations provide chat() for single responses and optionally stream_chat() for streaming.
ContextAwareTool
A tool that receives execution context from the graph.
Embeddings
Trait for embedding text into vectors.
MemoryStore
Persistent storage for conversation message history, keyed by session ID.
RuntimeAwareTool
Context-aware tool that receives runtime information.
Store
Persistent key-value store trait for cross-invocation state.
Tool
Defines an executable tool that can be called by an AI model. Each tool has a name, description, JSON schema for parameters, and an async call() method.

Functions§

filter_messages
Filter messages by type, name, or id.
get_buffer_string
Convert messages to a human-readable buffer string.
merge_message_runs
Merge consecutive messages of the same role into a single message.
trim_messages
Trim messages to fit within a token budget.

Type Aliases§

ChatStream
Type alias for a pinned, boxed async stream of AIMessageChunk results.
StreamWriter
Custom stream writer that nodes can use to emit custom events.