diff --git a/docs/my-website/docs/observability/langfuse_integration.md b/docs/my-website/docs/observability/langfuse_integration.md index dedbfff1ed..f66c5e163d 100644 --- a/docs/my-website/docs/observability/langfuse_integration.md +++ b/docs/my-website/docs/observability/langfuse_integration.md @@ -7,9 +7,6 @@ Detailed production traces and a granular view on quality, cost and latency -## Usage - log all LLM Providers (OpenAI, Azure, Anthropic, Cohere, Replicate, PaLM) -liteLLM provides `callbacks`, making it easy for you to log data depending on the status of your responses. - ## Pre-Requisites Ensure you have run `pip install langfuse` for this integration ```shell @@ -17,6 +14,15 @@ pip install langfuse litellm ``` ## Quick Start +Use just 2 lines of code, to instantly log your responses **across all providers** with Langfuse + + Open In Colab + + +Get your Langfuse API Keys from https://cloud.langfuse.com/ +```python +litellm.success_callback = ["langfuse"] +``` ```python # pip install langfuse import litellm @@ -25,6 +31,10 @@ import os # from https://cloud.langfuse.com/ os.environ["LANGFUSE_PUBLIC_KEY"] = "" os.environ["LANGFUSE_SECRET_KEY"] = "" +# Optional, defaults to https://cloud.langfuse.com +os.environ["LANGFUSE_HOST"] # optional + +# LLM API Keys os.environ['OPENAI_API_KEY']="" # set langfuse as a callback, litellm will send the data to langfuse @@ -39,71 +49,6 @@ response = litellm.completion( ) ``` - - Open In Colab - - -Get your Langfuse API Keys from https://cloud.langfuse.com/ - -Use just 2 lines of code, to instantly log your responses **across all providers** with langfuse: - -```python -litellm.success_callback = ["langfuse"] -``` - -## API keys for Langfuse -Set the following variables in your .env -```python -# Required -os.environ["LANGFUSE_SECRET_KEY"] -os.environ["LANGFUSE_PUBLIC_KEY"] - -# Optional, defaults to https://cloud.langfuse.com -os.environ["LANGFUSE_HOST"] # optional -``` - -## Complete code - -```python -import litellm -from litellm import completion -import os - -# from https://cloud.langfuse.com/ -os.environ["LANGFUSE_PUBLIC_KEY"] = "" -os.environ["LANGFUSE_SECRET_KEY"] = "" - - -# OpenAI and Cohere keys -# You can use any of the litellm supported providers: https://docs.litellm.ai/docs/providers -os.environ['OPENAI_API_KEY']="" -os.environ['COHERE_API_KEY']="" - -# set langfuse as a callback, litellm will send the data to langfuse -litellm.success_callback = ["langfuse"] - -# openai call -response = completion( - model="gpt-3.5-turbo", - messages=[ - {"role": "user", "content": "Hi 👋 - i'm openai"} - ] -) - -print(response) - -# cohere call -response = completion( - model="command-nightly", - messages=[ - {"role": "user", "content": "Hi 👋 - i'm cohere"} - ] -) - -print(response) - -``` - ## Advanced ### Set Custom Generation names, pass metadata