LangChain
Connect LangDB to LangChain using OpenAI-compatible setup to enhance LLM workflows with full tracing and streamlined monitoring.
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.
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.
Was this helpful?