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};
27#[allow(deprecated)]
28pub use tool::ToolRegistration;
29pub use tool::{
30    __tool_box, ExecutableTool, ParallelSafety, ToolArgParser, ToolArgs, ToolCategory,
31    ToolDefinition, ToolFn,
32};
33
34// Re-export for macro-generated code — ensures consistent serde/serde_json instances.
35pub use schemars;
36pub use serde;
37pub use serde_json;