Integration Langchain
observabilityllmsgenaicookbookprompt-managementhacktoberfestlarge-language-modelsnextraLangfuselangfuse-docs
Export
description: category: Integrations
This is a cookbook with examples of the Langfuse Integration for Langchain (Python).
Follow the integration guide to add this integration to your Langchain project. The integration also supports Langchain JS.
Setup
[1]
Initialize the Langfuse client with your API keys from the project settings in the Langfuse UI and add them to your environment.
[2]
[3]
Examples
[5]
'Barack Obama es de la ciudad de Chicago, Illinois, en los Estados Unidos.'
Runnable methods
Runnables are units of work that can be invoked, batched, streamed, transformed and composed.
The examples below show how to use the following methods with Langfuse:
- invoke/ainvoke: Transforms a single input into an output.
- batch/abatch: Efficiently transforms multiple inputs into outputs.
- stream/astream: Streams output from a single input as itโs produced.
[ ]
[9]
[10]
[11]
{'query': 'What did the president say about Ketanji Brown Jackson',
, 'result': " The president nominated her to serve on the United States Supreme Court and praised her as one of the nation's top legal minds who will continue the legacy of retiring Justice Stephen Breyer."} AzureOpenAI
[ ]
[ ]

