langtrace-python-sdk 2.0.3__py3-none-any.whl → 2.0.5__py3-none-any.whl
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.
- examples/anthropic_example/completion.py +1 -1
- examples/chroma_example/basic.py +1 -1
- examples/cohere_example/chat.py +7 -3
- examples/cohere_example/chat_stream.py +7 -2
- examples/cohere_example/embed.py +2 -1
- examples/cohere_example/rerank.py +2 -1
- examples/cohere_example/tools.py +21 -5
- examples/fastapi_example/basic_route.py +1 -1
- examples/hiveagent_example/basic.py +1 -1
- examples/langchain_example/groq_example.py +3 -1
- examples/langchain_example/langgraph_example.py +11 -12
- examples/llamaindex_example/agent.py +1 -1
- examples/llamaindex_example/basic.py +1 -1
- examples/openai_example/async_tool_calling_nonstreaming.py +11 -4
- examples/openai_example/async_tool_calling_streaming.py +41 -29
- examples/openai_example/chat_completion.py +12 -8
- examples/openai_example/embeddings_create.py +2 -1
- examples/openai_example/function_calling.py +11 -6
- examples/openai_example/images_generate.py +2 -1
- examples/openai_example/tool_calling.py +1 -1
- examples/openai_example/tool_calling_nonstreaming.py +11 -3
- examples/openai_example/tool_calling_streaming.py +42 -29
- examples/perplexity_example/basic.py +1 -1
- examples/pinecone_example/basic.py +4 -1
- examples/qdrant_example/basic.py +8 -6
- langtrace_python_sdk/constants/instrumentation/groq.py +0 -2
- langtrace_python_sdk/extensions/langtrace_exporter.py +4 -12
- langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +1 -2
- langtrace_python_sdk/instrumentation/anthropic/patch.py +14 -4
- langtrace_python_sdk/instrumentation/chroma/patch.py +4 -2
- langtrace_python_sdk/instrumentation/cohere/instrumentation.py +6 -3
- langtrace_python_sdk/instrumentation/groq/instrumentation.py +3 -1
- langtrace_python_sdk/instrumentation/groq/patch.py +26 -11
- langtrace_python_sdk/instrumentation/langchain/patch.py +4 -2
- langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +1 -2
- langtrace_python_sdk/instrumentation/langchain_community/patch.py +4 -3
- langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +3 -1
- langtrace_python_sdk/instrumentation/langchain_core/patch.py +4 -2
- langtrace_python_sdk/instrumentation/langgraph/instrumentation.py +17 -8
- langtrace_python_sdk/instrumentation/langgraph/patch.py +47 -26
- langtrace_python_sdk/instrumentation/llamaindex/patch.py +3 -1
- langtrace_python_sdk/instrumentation/openai/instrumentation.py +7 -3
- langtrace_python_sdk/instrumentation/openai/patch.py +40 -19
- langtrace_python_sdk/instrumentation/pinecone/patch.py +4 -2
- langtrace_python_sdk/instrumentation/qdrant/patch.py +4 -2
- langtrace_python_sdk/langtrace.py +128 -64
- langtrace_python_sdk/types/__init__.py +29 -0
- langtrace_python_sdk/utils/llm.py +2 -4
- langtrace_python_sdk/utils/with_root_span.py +3 -3
- langtrace_python_sdk/version.py +1 -1
- {langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/METADATA +2 -2
- {langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/RECORD +59 -58
- tests/chroma/test_chroma.py +26 -20
- tests/langchain/test_langchain.py +29 -16
- tests/langchain/test_langchain_community.py +28 -15
- tests/langchain/test_langchain_core.py +52 -26
- tests/pinecone/test_pinecone.py +27 -18
- {langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/WHEEL +0 -0
- {langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/licenses/LICENSE +0 -0
tests/pinecone/test_pinecone.py
CHANGED
|
@@ -14,35 +14,42 @@ from tests.utils import common_setup
|
|
|
14
14
|
|
|
15
15
|
class TestPinecone(unittest.TestCase):
|
|
16
16
|
data = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
"status": "success",
|
|
18
|
+
"message": "Data upserted successfully",
|
|
19
|
+
"upserted_ids": [1, 2, 3],
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
def setUp(self):
|
|
23
|
-
self.pinecone_mock, self.tracer, self.span = common_setup(self.data, 'pinecone.Index.upsert')
|
|
24
21
|
|
|
22
|
+
def setUp(self):
|
|
23
|
+
self.pinecone_mock, self.tracer, self.span = common_setup(
|
|
24
|
+
self.data, "pinecone.Index.upsert"
|
|
25
|
+
)
|
|
25
26
|
|
|
26
27
|
def tearDown(self):
|
|
27
28
|
self.pinecone_mock.stop()
|
|
28
29
|
|
|
29
30
|
def test_pinecone(self):
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
version = importlib.metadata.version(
|
|
31
|
+
|
|
32
|
+
# Arrange
|
|
33
|
+
version = importlib.metadata.version("pinecone-client")
|
|
33
34
|
method = "UPSERT"
|
|
34
35
|
vectors = [[1, 2, 3], [4, 5, 6]]
|
|
35
36
|
|
|
36
37
|
# Act
|
|
37
|
-
wrapped_function = generic_patch(
|
|
38
|
+
wrapped_function = generic_patch(
|
|
39
|
+
pinecone.Index.upsert, method, version, self.tracer
|
|
40
|
+
)
|
|
38
41
|
result = wrapped_function(MagicMock(), MagicMock(), (vectors,), {})
|
|
39
42
|
|
|
40
43
|
# Assert
|
|
41
|
-
self.assertTrue(
|
|
44
|
+
self.assertTrue(
|
|
45
|
+
self.tracer.start_as_current_span.called_once_with(
|
|
46
|
+
"pinecone.data.index", kind=SpanKind.CLIENT
|
|
47
|
+
)
|
|
48
|
+
)
|
|
42
49
|
api = APIS[method]
|
|
43
50
|
service_provider = SERVICE_PROVIDERS["PINECONE"]
|
|
44
51
|
expected_attributes = {
|
|
45
|
-
|
|
52
|
+
"langtrace.sdk.name": "langtrace-python-sdk",
|
|
46
53
|
"langtrace.service.name": service_provider,
|
|
47
54
|
"langtrace.service.type": "vectordb",
|
|
48
55
|
"langtrace.service.version": version,
|
|
@@ -52,21 +59,23 @@ class TestPinecone(unittest.TestCase):
|
|
|
52
59
|
}
|
|
53
60
|
self.assertTrue(
|
|
54
61
|
self.span.set_attribute.has_calls(
|
|
55
|
-
[call(key, value) for key, value in expected_attributes.items()],
|
|
62
|
+
[call(key, value) for key, value in expected_attributes.items()],
|
|
63
|
+
any_order=True,
|
|
56
64
|
)
|
|
57
|
-
)
|
|
65
|
+
)
|
|
58
66
|
|
|
59
67
|
actual_calls = self.span.set_attribute.call_args_list
|
|
60
68
|
|
|
61
69
|
for key, value in expected_attributes.items():
|
|
62
70
|
self.assertIn(call(key, value), actual_calls)
|
|
63
|
-
|
|
71
|
+
|
|
64
72
|
self.assertEqual(self.span.set_status.call_count, 1)
|
|
65
73
|
self.assertTrue(self.span.set_status.has_calls([call(Status(StatusCode.OK))]))
|
|
66
74
|
|
|
67
|
-
expected_result = [
|
|
75
|
+
expected_result = ["status", "message", "upserted_ids"]
|
|
68
76
|
result_keys = json.loads(result).keys()
|
|
69
77
|
self.assertSetEqual(set(expected_result), set(result_keys), "Keys mismatch")
|
|
70
78
|
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
|
|
80
|
+
if __name__ == "__main__":
|
|
81
|
+
unittest.main()
|
|
File without changes
|
{langtrace_python_sdk-2.0.3.dist-info → langtrace_python_sdk-2.0.5.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|