langfuse-haystack 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- langfuse_haystack-0.2.0/CHANGELOG.md +17 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/PKG-INFO +1 -1
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/src/haystack_integrations/tracing/langfuse/tracer.py +6 -3
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/.gitignore +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/LICENSE.txt +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/README.md +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/example/basic_rag.py +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/example/chat.py +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/example/requirements.txt +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/pydoc/config.yml +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/pyproject.toml +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/src/haystack_integrations/components/connectors/langfuse/__init__.py +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/src/haystack_integrations/components/connectors/langfuse/langfuse_connector.py +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/src/haystack_integrations/tracing/langfuse/__init__.py +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/tests/__init__.py +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/tests/test_langfuse_span.py +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/tests/test_tracer.py +0 -0
- {langfuse_haystack-0.1.0 → langfuse_haystack-0.2.0}/tests/test_tracing.py +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [integrations/langfuse-v0.1.0] - 2024-06-13
|
|
4
|
+
|
|
5
|
+
### 🚀 Features
|
|
6
|
+
|
|
7
|
+
- Langfuse integration (#686)
|
|
8
|
+
|
|
9
|
+
### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- Performance optimizations and value error when streaming in langfuse (#798)
|
|
12
|
+
|
|
13
|
+
### ⚙️ Miscellaneous Tasks
|
|
14
|
+
|
|
15
|
+
- Use ChatMessage to_openai_format, update unit tests, pydocs (#725)
|
|
16
|
+
|
|
17
|
+
<!-- generated by git-cliff -->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: langfuse-haystack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/langfuse#readme
|
|
5
5
|
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
6
6
|
Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/langfuse
|
|
@@ -9,6 +9,9 @@ from haystack.tracing import utils as tracing_utils
|
|
|
9
9
|
import langfuse
|
|
10
10
|
|
|
11
11
|
HAYSTACK_LANGFUSE_ENFORCE_FLUSH_ENV_VAR = "HAYSTACK_LANGFUSE_ENFORCE_FLUSH"
|
|
12
|
+
_SUPPORTED_GENERATORS = ["AzureOpenAIGenerator", "OpenAIGenerator"]
|
|
13
|
+
_SUPPORTED_CHAT_GENERATORS = ["AzureOpenAIChatGenerator", "OpenAIChatGenerator"]
|
|
14
|
+
_ALL_SUPPORTED_GENERATORS = _SUPPORTED_GENERATORS + _SUPPORTED_CHAT_GENERATORS
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
class LangfuseSpan(Span):
|
|
@@ -109,7 +112,7 @@ class LangfuseTracer(Tracer):
|
|
|
109
112
|
tags = tags or {}
|
|
110
113
|
span_name = tags.get("haystack.component.name", operation_name)
|
|
111
114
|
|
|
112
|
-
if tags.get("haystack.component.type") in
|
|
115
|
+
if tags.get("haystack.component.type") in _ALL_SUPPORTED_GENERATORS:
|
|
113
116
|
span = LangfuseSpan(self.current_span().raw_span().generation(name=span_name))
|
|
114
117
|
else:
|
|
115
118
|
span = LangfuseSpan(self.current_span().raw_span().span(name=span_name))
|
|
@@ -119,14 +122,14 @@ class LangfuseTracer(Tracer):
|
|
|
119
122
|
|
|
120
123
|
yield span
|
|
121
124
|
|
|
122
|
-
if tags.get("haystack.component.type")
|
|
125
|
+
if tags.get("haystack.component.type") in _SUPPORTED_GENERATORS:
|
|
123
126
|
meta = span._data.get("haystack.component.output", {}).get("meta")
|
|
124
127
|
if meta:
|
|
125
128
|
# Haystack returns one meta dict for each message, but the 'usage' value
|
|
126
129
|
# is always the same, let's just pick the first item
|
|
127
130
|
m = meta[0]
|
|
128
131
|
span._span.update(usage=m.get("usage") or None, model=m.get("model"))
|
|
129
|
-
elif tags.get("haystack.component.type")
|
|
132
|
+
elif tags.get("haystack.component.type") in _SUPPORTED_CHAT_GENERATORS:
|
|
130
133
|
replies = span._data.get("haystack.component.output", {}).get("replies")
|
|
131
134
|
if replies:
|
|
132
135
|
meta = replies[0].meta
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|