diff --git a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_langfuse_metadata.json b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_langfuse_metadata.json index a979448002d..5ed49cde972 100644 --- a/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_langfuse_metadata.json +++ b/tests/logging_callback_tests/langfuse_expected_request_body/completion_with_langfuse_metadata.json @@ -14,7 +14,6 @@ ] }, "langfuse.observation.level": "DEFAULT", - "langfuse.observation.metadata.test_key": "test_value", "langfuse.observation.model.name": "gpt-3.5-turbo", "langfuse.observation.model.parameters": { "extra_body": "{}" @@ -35,8 +34,23 @@ "cache_read_input_tokens": 0 }, "langfuse.release": "test_trace_release", + "langfuse.trace.input": { + "messages": [ + { + "role": "user", + "content": "Hello!" + } + ] + }, "langfuse.trace.metadata.test_key": "test_value", "langfuse.trace.name": "test_trace_name", + "langfuse.trace.output": { + "content": "Hello! How can I assist you today?", + "role": "assistant", + "tool_calls": null, + "function_call": null, + "provider_specific_fields": null + }, "langfuse.trace.tags": [ "test_tag", "test_tag_2" diff --git a/tests/logging_callback_tests/test_langfuse_dynamic_credentials.py b/tests/logging_callback_tests/test_langfuse_dynamic_credentials.py index ed4937f8f33..92466a9470c 100644 --- a/tests/logging_callback_tests/test_langfuse_dynamic_credentials.py +++ b/tests/logging_callback_tests/test_langfuse_dynamic_credentials.py @@ -69,7 +69,7 @@ def test_upstream_langfuse_env_only_warns_and_opens_no_second_channel(monkeypatc ) assert any("UPSTREAM_LANGFUSE_* is no longer supported" in record.getMessage() for record in caplog.records) - assert list(langfuse_sdk._TRACING.values()) == [logger.tracing] + assert [lease.tracing for lease in langfuse_sdk._TRACING.values()] == [logger.tracing] assert all(key.public_key == "public" for key in langfuse_sdk._TRACING) diff --git a/tests/logging_callback_tests/test_langfuse_e2e_test.py b/tests/logging_callback_tests/test_langfuse_e2e_test.py index 9d4f406b0b3..74933e92a99 100644 --- a/tests/logging_callback_tests/test_langfuse_e2e_test.py +++ b/tests/logging_callback_tests/test_langfuse_e2e_test.py @@ -24,7 +24,7 @@ os.environ["LANGFUSE_DEBUG"] = "True" import pytest import pytest_asyncio -LANGFUSE_EXPORT_POST: Final = "requests.Session.post" +LANGFUSE_EXPORT_POST: Final = "litellm.llms.custom_httpx.http_handler.HTTPHandler.post" LANGFUSE_EXPORT_PATH: Final = "/api/public/otel/v1/traces" _PER_RUN_ATTRIBUTES: Final = frozenset( @@ -64,7 +64,8 @@ def _decode_attribute(value: AnyValue) -> object: def _exported_spans(mock_post: MagicMock) -> list[dict[str, object]]: spans: list[dict[str, object]] = [] for call in mock_post.call_args_list: - assert call.kwargs["url"].endswith(LANGFUSE_EXPORT_PATH), call.kwargs["url"] + url: str = call.args[0] if call.args else call.kwargs["url"] + assert url.endswith(LANGFUSE_EXPORT_PATH), url request = ExportTraceServiceRequest.FromString(call.kwargs["data"]) for resource_spans in request.resource_spans: for scope_spans in resource_spans.scope_spans: