Skip to main content

Crate lc_providers

Crate lc_providers 

Source
Expand description

LLM provider integrations for langchainrust.

This crate provides unified chat model interfaces for:

  • OpenAI (GPT-5 / GPT-4o / o-series)
  • Generic OpenAI-compatible endpoints (openai_compatible): Groq, OpenRouter, xAI (Grok), and arbitrary self-hosted/private base URLs
  • Ollama (local LLMs like Llama, Mistral)
  • DeepSeek (cost-effective Chinese LLM)
  • Moonshot (long-context Kimi)
  • Qwen (Alibaba Cloud)
  • Zhipu (ChatGLM)
  • Anthropic (Claude)
  • Gemini (Google)

Re-exports§

pub use client::LLMClient;
pub use ollama::OllamaChat;
pub use ollama::OllamaConfig;
pub use openai::AssistantError;
pub use openai::BuiltinTool;
pub use openai::OpenAIAssistant;
pub use openai::OpenAIChat;
pub use openai::OpenAIConfig;
pub use openai::ResponsesConfig;
pub use openai::ResponsesError;
pub use openai::ResponsesModel;
pub use openai::OPENAI_MODELS;
pub use openai_compatible::GroqChat;
pub use openai_compatible::OpenAICompatibleChat;
pub use openai_compatible::OpenAICompatibleConfig;
pub use openai_compatible::OpenRouterChat;
pub use openai_compatible::XaiChat;
pub use openai_compatible::DEFAULT_GROQ_MODEL;
pub use openai_compatible::DEFAULT_XAI_MODEL;
pub use openai_compatible::GROQ_BASE_URL;
pub use openai_compatible::GROQ_MODELS;
pub use openai_compatible::OPENROUTER_BASE_URL;
pub use openai_compatible::XAI_BASE_URL;
pub use openai_compatible::XAI_MODELS;
pub use providers::AnthropicChat;
pub use providers::AnthropicConfig;
pub use providers::AnthropicError;
pub use providers::AnthropicStreamToken;
pub use providers::AnthropicStructuredOutputMethod;
pub use providers::AnthropicUsage;
pub use providers::AzureOpenAIChat;
pub use providers::AzureOpenAIConfig;
pub use providers::AzureOpenAIError;
pub use providers::CohereChat;
pub use providers::CohereConfig;
pub use providers::CohereError;
pub use providers::DeepSeekChat;
pub use providers::DeepSeekConfig;
pub use providers::GeminiChat;
pub use providers::GeminiConfig;
pub use providers::GeminiError;
pub use providers::GeminiStructuredOutputMethod;
pub use providers::MistralChat;
pub use providers::MistralConfig;
pub use providers::MoonshotChat;
pub use providers::MoonshotConfig;
pub use providers::QwenChat;
pub use providers::QwenConfig;
pub use providers::ThinkingConfig;
pub use providers::ThinkingType;
pub use providers::ZhipuChat;
pub use providers::ZhipuConfig;

Modules§

client
LLMClient — zero-config unified entry point. LLMClient — zero-config unified entry point for switching providers
ollama
Ollama local LLM integration. Ollama local model support
openai
OpenAI API integration.
openai_compatible
B5: generic OpenAI-compatible endpoint support (Groq, OpenRouter, xAI, vLLM, LM Studio, private gateways) — one transport, named presets. Generic OpenAI-compatible chat client (B5, v0.22.4).
providers
Third-party provider integrations. Third-party LLM provider integrations.

Structs§

ChatModelWrapper
Wrapper that converts any BaseChatModel’s error into ProviderError.

Enums§

ProviderError
Unified error type that aggregates all LLM provider errors.

Functions§

wrap_chat_model
Wrap any BaseChatModel into an Arc<dyn BaseChatModel<Error = ProviderError>>.