Skip to content

Commit eb3e5bd

Browse files
committed
docs: improve haystack integration docs, add note that content tracing env must be set before importing LangfuseConnector
1 parent 6f177d4 commit eb3e5bd

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

cookbook/integration_haystack.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@
131131
"source": [
132132
"The following code snippet (based off of the Haystack [documentation](https://docs.haystack.deepset.ai/docs/get_started)) walks through building a basic retrieval-augmented generative (RAG) pipeline. First you'll load your data to the Document Store, then connect components together into a RAG pipeline, and finally ask a question.\n",
133133
"\n",
134-
"First we build the pipeline. Add `LangfuseConnector` to the pipeline as a tracer. There's no need to connect it to any other component. The `LangfuseConnector` will automatically trace the operations and data flow within the pipeline. Then add the other components, like the text embedder, retriever, prompt builder and the model, and connect them together in the order they will be used in the pipeline."
134+
"First we build the pipeline. Add `LangfuseConnector` to the pipeline as a tracer. There's no need to connect it to any other component. The `LangfuseConnector` will automatically trace the operations and data flow within the pipeline. Then add the other components, like the text embedder, retriever, prompt builder and the model, and connect them together in the order they will be used in the pipeline.\n",
135+
"\n",
136+
"**Note**: Make sure to set the `HAYSTACK_CONTENT_TRACING_ENABLED` environment variable before importing `LangfuseConnector`."
135137
]
136138
},
137139
{
@@ -1610,7 +1612,9 @@
16101612
"id": "YiuP6i7ncYUj"
16111613
},
16121614
"source": [
1613-
"Here is another example connecting a RAG pipeline to a chat generator. Using a component like Haystack's `DynamicChatPromptBuilder` is a great way to add a chat component to your application, which can add a level of personalization and interactivity to your program."
1615+
"Here is another example connecting a RAG pipeline to a chat generator. Using a component like Haystack's `DynamicChatPromptBuilder` is a great way to add a chat component to your application, which can add a level of personalization and interactivity to your program.\n",
1616+
"\n",
1617+
"**Note**: Make sure to set the `HAYSTACK_CONTENT_TRACING_ENABLED` environment variable before importing `LangfuseConnector`."
16141618
]
16151619
},
16161620
{

pages/docs/integrations/haystack/example-python.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ The following code snippet (based off of the Haystack [documentation](https://do
6969

7070
First we build the pipeline. Add `LangfuseConnector` to the pipeline as a tracer. There's no need to connect it to any other component. The `LangfuseConnector` will automatically trace the operations and data flow within the pipeline. Then add the other components, like the text embedder, retriever, prompt builder and the model, and connect them together in the order they will be used in the pipeline.
7171

72+
**Note**: Make sure to set the `HAYSTACK_CONTENT_TRACING_ENABLED` environment variable before importing `LangfuseConnector`.
73+
7274

7375
```python
7476
from datasets import load_dataset
@@ -178,6 +180,8 @@ Learn more about tracing in the [docs](https://langfuse.com/docs/tracing).
178180

179181
Here is another example connecting a RAG pipeline to a chat generator. Using a component like Haystack's `DynamicChatPromptBuilder` is a great way to add a chat component to your application, which can add a level of personalization and interactivity to your program.
180182

183+
**Note**: Make sure to set the `HAYSTACK_CONTENT_TRACING_ENABLED` environment variable before importing `LangfuseConnector`.
184+
181185

182186
```python
183187
from haystack import Pipeline

pages/docs/integrations/haystack/get-started.mdx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pip install haystack-ai langfuse-haystack langfuse
5050
### Set Environment Variables
5151

5252
1. Langfuse: You can find your Langfuse public and private API keys in the project settings.
53-
2. Haystack: Enable `HAYSTACK_CONTENT_TRACING_ENABLED`.
53+
2. Haystack: Enable `HAYSTACK_CONTENT_TRACING_ENABLED`. **You must set this variable before importing `LangfuseConnector`.**
5454

5555
```python
5656
import os
@@ -66,6 +66,24 @@ os.environ["LANGFUSE_HOST"] = "https://cloud.langfuse.com" # 🇪🇺 EU region
6666
os.environ["HAYSTACK_CONTENT_TRACING_ENABLED"] = "True"
6767
```
6868

69+
### Add `LangfuseConnector` to your pipeline
70+
71+
Add `LangfuseConnector` to the pipeline as a tracer. There's no need to connect it to any other component. The LangfuseConnector will automatically trace the operations and data flow within the pipeline. Then add the other components, like the text embedder, retriever, prompt builder and the model, and connect them together in the order they will be used in the pipeline.
72+
73+
```python
74+
from haystack import Pipeline
75+
from haystack_integrations.components.connectors.langfuse import LangfuseConnector
76+
77+
# Example pipeline
78+
example_pipeline = Pipeline()
79+
80+
# Add LangfuseConnector to the pipeline
81+
example_pipeline.add_component("tracer", LangfuseConnector("Example Pipeline"))
82+
83+
# Add other components and use the pipeline
84+
# ...
85+
```
86+
6987
</Steps>
7088

7189
<Callout type="info" emoji="">
@@ -99,3 +117,7 @@ import { FileCode } from "lucide-react";
99117
## Acknowledgement
100118

101119
We're thrilled to collaborate with the Haystack team to give the best possible experience to devs when building complex RAG applications. Thanks to them for developing this intgeration.
120+
121+
```
122+
123+
```

pages/guides/cookbook/integration_haystack.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ The following code snippet (based off of the Haystack [documentation](https://do
6969

7070
First we build the pipeline. Add `LangfuseConnector` to the pipeline as a tracer. There's no need to connect it to any other component. The `LangfuseConnector` will automatically trace the operations and data flow within the pipeline. Then add the other components, like the text embedder, retriever, prompt builder and the model, and connect them together in the order they will be used in the pipeline.
7171

72+
**Note**: Make sure to set the `HAYSTACK_CONTENT_TRACING_ENABLED` environment variable before importing `LangfuseConnector`.
73+
7274

7375
```python
7476
from datasets import load_dataset
@@ -178,6 +180,8 @@ Learn more about tracing in the [docs](https://langfuse.com/docs/tracing).
178180

179181
Here is another example connecting a RAG pipeline to a chat generator. Using a component like Haystack's `DynamicChatPromptBuilder` is a great way to add a chat component to your application, which can add a level of personalization and interactivity to your program.
180182

183+
**Note**: Make sure to set the `HAYSTACK_CONTENT_TRACING_ENABLED` environment variable before importing `LangfuseConnector`.
184+
181185

182186
```python
183187
from haystack import Pipeline

0 commit comments

Comments
 (0)