Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
fix: upgrade langfuse code examples to langfuse python sdk v3 (#3030)
Jannik Maierhöferec2903e5ee06
diff --git a/docs/observability/langfuse.mdx b/docs/observability/langfuse.mdxindex 0202f39ef..1cfed6d9d 100644--- a/docs/observability/langfuse.mdx+++ b/docs/observability/langfuse.mdx@@ -30,18 +30,29 @@ Set your Langfuse API keys and configure OpenTelemetry export settings to send t```pythonimport os-import base64--LANGFUSE_PUBLIC_KEY="pk-lf-..."-LANGFUSE_SECRET_KEY="sk-lf-..."-LANGFUSE_AUTH=base64.b64encode(f"{LANGFUSE_PUBLIC_KEY}:{LANGFUSE_SECRET_KEY}".encode()).decode()--os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://cloud.langfuse.com/api/public/otel" # EU data region-# os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://us.cloud.langfuse.com/api/public/otel" # US data region-os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"Authorization=Basic {LANGFUSE_AUTH}"++# Get keys for your project from the project settings page: https://cloud.langfuse.com+os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf-..."+os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf-..."+os.environ["LANGFUSE_HOST"] = "https://cloud.langfuse.com" # 🇪🇺 EU region+# os.environ["LANGFUSE_HOST"] = "https://us.cloud.langfuse.com" # 🇺🇸 US region+++# Your OpenAI key+os.environ["OPENAI_API_KEY"] = "sk-proj-..."+```+With the environment variables set, we can now initialize the Langfuse client. get_client() initializes the Langfuse client using the credentials provided in the environment variables.-# your openai key-os.environ["OPENAI_API_KEY"] = "sk-..."+```python+from langfuse import get_client++langfuse = get_client()++# Verify connection+if langfuse.auth_check():+ print("Langfuse client is authenticated and ready!")+else:+ print("Authentication failed. Please check your credentials and host.")```### Step 3: Initialize OpenLit