Introducing Virtual MCP Servers
LogoLogo
GithubJoin SlackSignupBook a Demo
  • Documentation
  • Self Hosted
  • Integrations
  • Guides
  • Enterprise
  • Examples
  • OpenAI
  • Vercel AI SDK
  • DeepSeek
  • Anthropic
  • LangChain
  • CrewAI
  • Gemini
  • Bedrock
  • xAI
  • TogetherAI
  • FireworksAI
  • DeepInfra
  • OpenRouter
  • Smithery
  • LlamaIndex
  • Supabase
  • Mem0
Powered by GitBook
LogoLogo

Social

  • LinkedIn
  • X
  • Youtube
  • Github

Platform

  • Pricing
  • Documentation
  • Blog

Company

  • Home
  • About

Legal

  • Privacy Policy
  • Terms of Service

2025 LangDB. All rights reserved.

On this page

Was this helpful?

Export as PDF

LangChain

Connect LangDB to LangChain using OpenAI-compatible setup to enhance LLM workflows with full tracing and streamlined monitoring.

PreviousAnthropicNextCrewAI

Was this helpful?

LangDB integrates seamlessly with popular libraries like LangChain, providing tracing support to capture detailed logs for workflows. Below is a complete example of using LangChain with LangDB.

1

Install LangChain

pip install langchain langchain-openai
2

Add LangDB to your Code

from langchain_openai import ChatOpenAI

api_base = "https://api.us-east-1.langdb.ai"
api_key = "xxxx" # LangDB API Key
default_headers = {
    "x-project-id": "xxxxx",  ### LangDB Project ID
}
llm = ChatOpenAI(
    model_name='gpt-4o' , 
    temperature=0.3, 
    openai_api_base=api_base, 
    default_headers=default_headers,
    disable_streaming=True )

# Your LangChain Code here

Check out full examples in the .

samples