langfuse-haystack 5.1.0__tar.gz → 5.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-5.1.0 → langfuse_haystack-5.2.0}/CHANGELOG.md +19 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/PKG-INFO +1 -1
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/src/haystack_integrations/tracing/langfuse/tracer.py +28 -1
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/tests/test_tracer.py +73 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/.gitignore +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/LICENSE.txt +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/README.md +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/example/basic_rag.py +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/example/chat.py +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/example/requirements.txt +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/pydoc/config_docusaurus.yml +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/pyproject.toml +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/src/haystack_integrations/components/connectors/langfuse/__init__.py +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/src/haystack_integrations/components/connectors/langfuse/langfuse_connector.py +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/src/haystack_integrations/components/connectors/py.typed +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/src/haystack_integrations/tracing/langfuse/__init__.py +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/src/haystack_integrations/tracing/py.typed +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/tests/__init__.py +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/tests/conftest.py +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/tests/test_langfuse_connector.py +0 -0
- {langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/tests/test_tracing.py +0 -0
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [integrations/langfuse-v5.1.0] - 2026-07-08
|
|
4
|
+
|
|
5
|
+
### 🐛 Bug Fixes
|
|
6
|
+
|
|
7
|
+
- *(langfuse)* Stop relying on `haystack.utils.base_serialization` helpers (#3563)
|
|
8
|
+
|
|
9
|
+
### 📚 Documentation
|
|
10
|
+
|
|
11
|
+
- Replace old haystack core imports with haystack_integrations paths (#3545)
|
|
12
|
+
|
|
13
|
+
### 🧪 Testing
|
|
14
|
+
|
|
15
|
+
- Trust test modules under Haystack 3.0's deserialization allowlist (#3537)
|
|
16
|
+
|
|
17
|
+
### 🧹 Chores
|
|
18
|
+
|
|
19
|
+
- Improve consistency of integrations folder structure (#3430)
|
|
20
|
+
|
|
21
|
+
|
|
3
22
|
## [integrations/langfuse-v5.0.2] - 2026-06-01
|
|
4
23
|
|
|
5
24
|
### 🐛 Bug Fixes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langfuse-haystack
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.2.0
|
|
4
4
|
Summary: Langfuse integration for Haystack
|
|
5
5
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/langfuse#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
@@ -345,10 +345,13 @@ class DefaultSpanHandler(SpanHandler):
|
|
|
345
345
|
# special case for ToolInvoker (to update the span name to be: `original_component_name - [tool_names]`)
|
|
346
346
|
if component_type == "ToolInvoker":
|
|
347
347
|
tool_names: list[str] = []
|
|
348
|
+
tool_calls_input: list[dict[str, Any]] = []
|
|
348
349
|
messages = span.get_data().get(_COMPONENT_INPUT_KEY, {}).get("messages", [])
|
|
349
350
|
for message in messages:
|
|
350
351
|
if isinstance(message, ChatMessage) and message.tool_calls:
|
|
351
|
-
|
|
352
|
+
for call in message.tool_calls:
|
|
353
|
+
tool_names.append(call.tool_name)
|
|
354
|
+
tool_calls_input.append({"tool_name": call.tool_name, "arguments": call.arguments})
|
|
352
355
|
|
|
353
356
|
if tool_names:
|
|
354
357
|
# Fallback to "ToolInvoker" if we can't retrieve component name
|
|
@@ -357,6 +360,30 @@ class DefaultSpanHandler(SpanHandler):
|
|
|
357
360
|
formatted_names = [f"{name} (x{count})" if count > 1 else name for name, count in tool_counts.items()]
|
|
358
361
|
span.raw_span().update(name=f"{tool_invoker_name} - {sorted(formatted_names)}")
|
|
359
362
|
|
|
363
|
+
if tool_calls_input and proxy_tracer.is_content_tracing_enabled:
|
|
364
|
+
# Replace the noisy full message history with just the tool call arguments
|
|
365
|
+
span.raw_span().update(input=tool_calls_input)
|
|
366
|
+
|
|
367
|
+
output_messages = span.get_data().get(_COMPONENT_OUTPUT_KEY, {}).get("tool_messages", [])
|
|
368
|
+
tool_results: list[dict[str, Any]] = []
|
|
369
|
+
for message in output_messages:
|
|
370
|
+
if isinstance(message, ChatMessage) and message.tool_call_results:
|
|
371
|
+
for tcr in message.tool_call_results:
|
|
372
|
+
origin = tcr.origin
|
|
373
|
+
# Keys `name`, `arguments` and `id` let Langfuse detect these as tool
|
|
374
|
+
# calls at ingestion and populate the Tool Call Name filter in the UI.
|
|
375
|
+
tool_results.append(
|
|
376
|
+
{
|
|
377
|
+
"id": origin.id if origin else None,
|
|
378
|
+
"name": origin.tool_name if origin else None,
|
|
379
|
+
"arguments": origin.arguments if origin else None,
|
|
380
|
+
"result": tcr.result,
|
|
381
|
+
"error": tcr.error,
|
|
382
|
+
}
|
|
383
|
+
)
|
|
384
|
+
if tool_results:
|
|
385
|
+
span.raw_span().update(output=tool_results)
|
|
386
|
+
|
|
360
387
|
if component_type and component_type.endswith("ChatGenerator"):
|
|
361
388
|
replies = span.get_data().get(_COMPONENT_OUTPUT_KEY, {}).get("replies")
|
|
362
389
|
if replies:
|
|
@@ -748,6 +748,79 @@ class TestLangfuseTracer:
|
|
|
748
748
|
assert "search_tool (x2)" in updated_name, f"Expected 'search_tool (x2)' in {updated_name}"
|
|
749
749
|
assert "weather_tool" in updated_name, f"Expected 'weather_tool' in {updated_name}"
|
|
750
750
|
|
|
751
|
+
def test_handle_tool_invoker_input_output_with_content_tracing(self):
|
|
752
|
+
"""
|
|
753
|
+
Test that ToolInvoker spans replace the noisy full-message input with just tool call
|
|
754
|
+
arguments, and populate output with tool results, when content tracing is enabled.
|
|
755
|
+
"""
|
|
756
|
+
mock_span = Mock()
|
|
757
|
+
mock_span.raw_span.return_value = mock_span
|
|
758
|
+
|
|
759
|
+
tool_call = ToolCall(id="call_123", tool_name="search_tool", arguments={"query": "RAG pipelines"})
|
|
760
|
+
|
|
761
|
+
span_data = {
|
|
762
|
+
"haystack.component.name": "tool_invoker",
|
|
763
|
+
"haystack.component.type": "ToolInvoker",
|
|
764
|
+
"haystack.component.input": {
|
|
765
|
+
"messages": [
|
|
766
|
+
ChatMessage.from_user("what is RAG?"),
|
|
767
|
+
ChatMessage.from_assistant(text="Calling search", tool_calls=[tool_call]),
|
|
768
|
+
]
|
|
769
|
+
},
|
|
770
|
+
"haystack.component.output": {
|
|
771
|
+
"tool_messages": [ChatMessage.from_tool("RAG stands for Retrieval-Augmented Generation", tool_call)]
|
|
772
|
+
},
|
|
773
|
+
}
|
|
774
|
+
mock_span.get_data.return_value = span_data
|
|
775
|
+
|
|
776
|
+
handler = DefaultSpanHandler()
|
|
777
|
+
with patch("haystack_integrations.tracing.langfuse.tracer.proxy_tracer.is_content_tracing_enabled", True):
|
|
778
|
+
handler.handle(mock_span, component_type="ToolInvoker")
|
|
779
|
+
|
|
780
|
+
update_calls = {k: v for call in mock_span.update.call_args_list for k, v in call[1].items()}
|
|
781
|
+
|
|
782
|
+
# input should be just the tool call arguments, not the full message list
|
|
783
|
+
assert update_calls["input"] == [{"tool_name": "search_tool", "arguments": {"query": "RAG pipelines"}}]
|
|
784
|
+
# output carries id/name/arguments so Langfuse detects the tool call and populates its filter
|
|
785
|
+
assert update_calls["output"] == [
|
|
786
|
+
{
|
|
787
|
+
"id": "call_123",
|
|
788
|
+
"name": "search_tool",
|
|
789
|
+
"arguments": {"query": "RAG pipelines"},
|
|
790
|
+
"result": "RAG stands for Retrieval-Augmented Generation",
|
|
791
|
+
"error": False,
|
|
792
|
+
}
|
|
793
|
+
]
|
|
794
|
+
|
|
795
|
+
def test_handle_tool_invoker_no_content_tracing(self):
|
|
796
|
+
"""
|
|
797
|
+
Test that ToolInvoker input/output is NOT updated when content tracing is disabled.
|
|
798
|
+
The span name update (tool names) should still happen.
|
|
799
|
+
"""
|
|
800
|
+
mock_span = Mock()
|
|
801
|
+
mock_span.raw_span.return_value = mock_span
|
|
802
|
+
|
|
803
|
+
tool_call = ToolCall(tool_name="weather_tool", arguments={"location": "Tokyo"})
|
|
804
|
+
|
|
805
|
+
span_data = {
|
|
806
|
+
"haystack.component.name": "tool_invoker",
|
|
807
|
+
"haystack.component.type": "ToolInvoker",
|
|
808
|
+
"haystack.component.input": {"messages": [ChatMessage.from_assistant(text="", tool_calls=[tool_call])]},
|
|
809
|
+
"haystack.component.output": {"tool_messages": [ChatMessage.from_tool("Sunny, 28°C", tool_call)]},
|
|
810
|
+
}
|
|
811
|
+
mock_span.get_data.return_value = span_data
|
|
812
|
+
|
|
813
|
+
handler = DefaultSpanHandler()
|
|
814
|
+
with patch("haystack_integrations.tracing.langfuse.tracer.proxy_tracer.is_content_tracing_enabled", False):
|
|
815
|
+
handler.handle(mock_span, component_type="ToolInvoker")
|
|
816
|
+
|
|
817
|
+
update_kwargs_keys = {k for call in mock_span.update.call_args_list for k in call[1]}
|
|
818
|
+
# name should still be updated
|
|
819
|
+
assert "name" in update_kwargs_keys
|
|
820
|
+
# input and output must NOT be set when content tracing is off
|
|
821
|
+
assert "input" not in update_kwargs_keys
|
|
822
|
+
assert "output" not in update_kwargs_keys
|
|
823
|
+
|
|
751
824
|
def test_trace_generation_invalid_start_time(self):
|
|
752
825
|
with patch("haystack_integrations.tracing.langfuse.tracer.langfuse.get_client"):
|
|
753
826
|
tracer = LangfuseTracer(tracer=MockLangfuseClient(), name="Haystack", public=False)
|
|
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
|
{langfuse_haystack-5.1.0 → langfuse_haystack-5.2.0}/src/haystack_integrations/tracing/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|