Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(quickstart+readme): add python SDK v3 examples (#7157)

Hassieb Pakzadb51f321d22fb
diff --git a/README.cn.md b/README.cn.md
index 5ed5d4bd50..f999ba85c8 100644
--- a/README.cn.md
+++ b/README.cn.md
@@ -213,8 +213,8 @@ LANGFUSE_HOST="https://cloud.langfuse.com" # 🇪🇺 欧盟区域
创建示例代码(文件名:**main.py**):
-````python:main.py
-from langfuse.decorators import observe
+```python:main.py
+from langfuse import observe
from langfuse.openai import openai # OpenAI 集成
@observe()
diff --git a/README.ja.md b/README.ja.md
index e544c4a575..869825c9ad 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -219,7 +219,7 @@ LANGFUSE_HOST="https://cloud.langfuse.com" # 🇪🇺 EUリージョン
```
```python:/@observe()/ /from langfuse.openai import openai/ filename="main.py"
-from langfuse.decorators import observe
+from langfuse import observe
from langfuse.openai import openai # OpenAI統合
@observe()
diff --git a/README.kr.md b/README.kr.md
index 089ca1993e..58ffe7d547 100644
--- a/README.kr.md
+++ b/README.kr.md
@@ -201,7 +201,7 @@ LANGFUSE_HOST="https://cloud.langfuse.com" # 🇪🇺 EU region
```
```python:main.py
-from langfuse.decorators import observe
+from langfuse import observe
from langfuse.openai import openai # OpenAI integration
@observe()
diff --git a/README.md b/README.md
index 80010478b8..c5f90f18d4 100644
--- a/README.md
+++ b/README.md
@@ -190,7 +190,7 @@ LANGFUSE_HOST="https://cloud.langfuse.com" # 🇪🇺 EU region
```
```python /@observe()/ /from langfuse.openai import openai/ filename="main.py"
-from langfuse.decorators import observe
+from langfuse import observe
from langfuse.openai import openai # OpenAI integration
@observe()
diff --git a/web/src/features/public-api/components/QuickstartExamples.tsx b/web/src/features/public-api/components/QuickstartExamples.tsx
index f3a80f75a5..b6eb134ccb 100644
--- a/web/src/features/public-api/components/QuickstartExamples.tsx
+++ b/web/src/features/public-api/components/QuickstartExamples.tsx
@@ -22,7 +22,6 @@ export const QuickstartExamples = (p: {
{ value: "openai", label: "OpenAI" },
{ value: "langchain", label: "Langchain" },
{ value: "langchain-js", label: "Langchain JS" },
- { value: "llamaindex", label: "LlamaIndex" },
{ value: "other", label: "Other" },
];
const host = `${uiCustomization?.hostname ?? window.origin}${env.NEXT_PUBLIC_BASE_PATH ?? ""}`;
@@ -196,32 +195,6 @@ export const QuickstartExamples = (p: {
for more details and an end-to-end example.
</p>
</TabsContent>
- <TabsContent value="llamaindex">
- <p className="mt-2 text-xs text-muted-foreground">
- The integration uses the LlamaIndex callback system to automatically
- capture detailed traces of your LlamaIndex executions.
- </p>
- <CodeView
- content="pip install langfuse llama-index"
- className="my-2"
- />
- <CodeView
- content={LLAMA_INDEX_CODE({ publicKey, secretKey, host })}
- className="my-2"
- />
- <p className="mt-2 text-xs text-muted-foreground">
- See the{" "}
- <a
- href="https://langfuse.com/docs/integrations/llama-index"
- className="underline"
- target="_blank"
- rel="noopener noreferrer"
- >
- LlamaIndex Integration docs
- </a>{" "}
- for more details and an end-to-end example.
- </p>
- </TabsContent>
<TabsContent value="other">
<p className="mt-2 text-xs text-muted-foreground">
Use the{" "}
@@ -283,13 +256,17 @@ const LANGCHAIN_PYTHON_CODE = (p: {
publicKey: string;
secretKey: string;
host: string;
-}) => `from langfuse.callback import CallbackHandler
-langfuse_handler = CallbackHandler(
+}) => `from langfuse import Langfuse
+from langfuse.langchain import CallbackHandler
+
+langfuse = Langfuse(
public_key="${p.publicKey}",
secret_key="${p.secretKey}",
host="${p.host}"
)
+langfuse_handler = CallbackHandler()
+
# <Your Langchain code here>
# Add handler to run/invoke/call/chat
@@ -316,18 +293,3 @@ await chain.invoke(
{ input: "<user_input>" },
{ callbacks: [langfuseHandler] }
);`;
-
-const LLAMA_INDEX_CODE = (p: {
- publicKey: string;
- secretKey: string;
- host: string;
-}) => `from llama_index.core import Settings
-from llama_index.core.callbacks import CallbackManager
-from langfuse.llama_index import LlamaIndexCallbackHandler
-
-langfuse_callback_handler = LlamaIndexCallbackHandler(
- public_key="${p.publicKey}",
- secret_key="${p.secretKey}",
- host="${p.host}"
-)
-Settings.callback_manager = CallbackManager([langfuse_callback_handler])`;