Expand description
Core abstractions for LangChainRust.
This crate provides the foundational traits and types:
Runnable: Base execution interfaceBaseLanguageModel: LLM abstractionBaseChatModel: Chat model interfaceBaseTool,Tool: Tool abstractionRunnableConfig: Execution configuration with callbacks- Output parsers, structured output, caching, token counting, batch API
Re-exports§
pub use json_parse::parse_llm_json;pub use json_parse::parse_llm_json_with_retry;pub use json_parse::LlmJsonParseError;pub use judge::structured_call;pub use judge::truncate;pub use judge::StructuredJudgeError;pub use language_models::predict_tools;pub use language_models::BaseChatModel;pub use language_models::BaseLanguageModel;pub use language_models::MultimodalError;pub use language_models::MultimodalModel;pub use language_models::PredictToolsError;pub use output_parsers::BaseOutputParser;pub use output_parsers::CommaSeparatedListOutputParser;pub use output_parsers::JsonOutputParser;pub use output_parsers::OutputParserError;pub use output_parsers::OutputParserResult;pub use output_parsers::StrOutputParser;pub use output_parsers::StructuredOutputParser;pub use output_parsers::TypedOutputParser;pub use runnables::into_runnable_any;pub use runnables::CancellationToken;pub use runnables::LcelError;pub use runnables::RetryConfig;pub use runnables::RetryOn;pub use runnables::Runnable;pub use runnables::RunnableAny;pub use runnables::RunnableAnyWrapper;pub use runnables::RunnableAssign;pub use runnables::RunnableBinding;pub use runnables::RunnableBranch;pub use runnables::RunnableConfig;pub use runnables::RunnableConfigurable;pub use runnables::RunnableConfigurableFields;pub use runnables::RunnableExt;pub use runnables::RunnableLambda;pub use runnables::RunnableParallel;pub use runnables::RunnablePassthrough;pub use runnables::RunnablePick;pub use runnables::RunnableRetry;pub use runnables::RunnableSequence;pub use runnables::RunnableWithFallbacks;pub use structured_output::stream_structured_output;pub use structured_output::with_structured_output;pub use structured_output::PartialJsonError;pub use structured_output::PartialJsonParser;pub use structured_output::StreamingStructuredOutputExt;pub use structured_output::StructuredOutputError;pub use structured_output::StructuredOutputExt;pub use tools::BaseTool;pub use tools::FunctionDefinition;pub use tools::StructuredOutput;pub use tools::Tool;pub use tools::ToolDefinition;pub use tools::ToolError;pub use tools::ToolRegistry;
Modules§
- batch
- Batch API client for OpenAI and Anthropic batch processing.
- cache
- LLM 调用缓存
- json_
parse - Tolerant JSON parsing for LLM outputs.
- judge
- 共享 LLM 裁判基础设施:让 LLM 以结构化参数返回判定。
- language_
models - Language model base traits.
- math
- Shared math utilities.
- output_
parsers - Output parsers for extracting and transforming LLM response text.
- router_
llm - Model routing, fallback and load balancing.
- runnables
- Runnable module - LangChain Expression Language (LCEL) core
- structured_
output - Structured output utilities for extracting typed data from LLM responses.
- token_
counter - Token counter and cost tracking
- tools
- Tool abstractions for agent function calling.
Structs§
- Function
Call - Function call inside a ToolCall
- Tool
Call - Tool call from LLM response
- Tool
Call Builder - Builder for constructing a
ToolCallfield by field. - Tool
Call Result - Tool call result to send back to LLM
Enums§
- Core
Error - Unified error type for the lc-core crate.
Functions§
- other_
error - Helper to convert any error into
CoreError::Other. Use this instead of?when the error type is not a known CoreError variant.