Skip to main content

Crate langchainrust

Crate langchainrust 

Source
Expand description

LangChain Rust - A LangChain-compatible framework for building LLM applications

This crate is a Rust implementation inspired by LangChain Python.

§Example

use langchainrust::core::RunnableConfig;
use langchainrust::core::runnables::Runnable;

let config = RunnableConfig::new()
    .with_tag("example")
    .with_run_name("my_run");

Re-exports§

pub use core::Runnable;
pub use core::RunnableConfig;
pub use core::BaseLanguageModel;
pub use core::BaseChatModel;
pub use core::BaseTool;
pub use core::Tool;
pub use core::ToolError;
pub use core::ToolRegistry;
pub use schema::Message;
pub use schema::MessageType;
pub use language_models::OpenAIChat;
pub use language_models::OpenAIConfig;
pub use tools::Calculator;
pub use tools::CalculatorInput;
pub use tools::DateTimeTool;
pub use tools::DateTimeInput;
pub use tools::SimpleMathTool;
pub use tools::MathInput;
pub use tools::URLFetchTool;
pub use tools::URLFetchInput;
pub use agents::AgentAction;
pub use agents::AgentFinish;
pub use agents::AgentStep;
pub use agents::AgentOutput;
pub use agents::ToolInput;
pub use agents::BaseAgent;
pub use agents::AgentExecutor;
pub use agents::AgentError;
pub use agents::ReActAgent;
pub use memory::BaseMemory;
pub use memory::MemoryError;
pub use memory::ChatMessageHistory;
pub use memory::ConversationBufferMemory;
pub use memory::ConversationBufferWindowMemory;
pub use chains::BaseChain;
pub use chains::ChainError;
pub use chains::ChainResult;
pub use chains::LLMChain;
pub use chains::LLMChainBuilder;
pub use chains::SequentialChain;
pub use embeddings::Embeddings;
pub use embeddings::EmbeddingError;
pub use embeddings::OpenAIEmbeddings;
pub use embeddings::OpenAIEmbeddingsConfig;
pub use embeddings::MockEmbeddings;
pub use embeddings::cosine_similarity;
pub use vector_stores::Document;
pub use vector_stores::SearchResult;
pub use vector_stores::VectorStore;
pub use vector_stores::VectorStoreError;
pub use vector_stores::InMemoryVectorStore;
pub use retrieval::Retriever;
pub use retrieval::SimilarityRetriever;
pub use retrieval::RetrieverTrait;
pub use retrieval::TextSplitter;
pub use retrieval::RecursiveCharacterSplitter;
pub use prompts::PromptTemplate;
pub use prompts::ChatPromptTemplate;

Modules§

agents
Agent 系统
chains
Chains 系统
core
核心模块 - LangChain Rust 的基础抽象
embeddings
Embedding 模型实现
language_models
语言模型实现
memory
Memory 系统
prompts
提示词模板模块
retrieval
检索模块
schema
Schema module - data structures for LangChain
tools
内置工具实现
vector_stores
向量存储实现