Skip to main content

lellm_core/
lib.rs

1//! lellm-core — 协议对象,零运行时依赖。
2//!
3//! 定义 LLM 交互的核心数据结构:Message, ContentBlock, ChatRequest,
4//! ChatResponse, ToolCall, ToolDefinition, TokenUsage, LlmError 等。
5//!
6//! 本 crate 是纯粹的协议层(Protocol Crate),类似 openai-types / anthropic-types
7//! 的统一抽象。Provider、Agent、Graph 都依赖于此,但它不依赖任何运行时。
8
9pub mod error;
10pub mod message;
11pub mod prompt;
12pub mod request;
13pub mod response;
14pub mod tool;
15
16pub use error::{
17    IntoToolError, IntoToolResult, LellmError, LlmError, MemoryError, ParseError, ToolError,
18    ToolErrorKind, ToolResult,
19};
20pub use message::{
21    CacheControl, ContentBlock, ImageSource, Message, TextBlock, ThinkingBlock, ToolCall,
22    text_block,
23};
24pub use prompt::Prompt;
25pub use request::{ChatRequest, ReasoningConfig, ToolChoice};
26pub use response::{ChatResponse, TokenUsage};
27pub use tool::{
28    __tool_box, ExecutableTool, ParallelSafety, ToolArgs, ToolCategory, ToolDefinition, ToolFn,
29    ToolSchema,
30};
31
32// Re-export for macro-generated code — ensures consistent serde/schemars instances.
33pub use schemars;
34pub use serde;