Skip to main content Crate synaptic_core Copy item path Source 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. InputTokenDetails Detailed breakdown of input token usage. InvalidToolCall A tool call that failed to parse correctly. OutputTokenDetails Detailed breakdown of output token usage. RunnableConfig Runtime configuration passed through runnable chains, including tags, metadata, concurrency limits, and run identification. 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. ToolDefinition Schema definition for a tool, including its name, description, and JSON Schema for parameters. 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. SynapseError Unified error type for the Synapse 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. 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. MemoryStore Persistent storage for conversation message history, keyed by session ID. 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. 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. ChatStream Type alias for a pinned, boxed async stream of AIMessageChunk results.