langtrace-python-sdk 3.6.0__py3-none-any.whl → 3.6.1__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.
- langtrace_python_sdk/instrumentation/openai/patch.py +28 -36
- langtrace_python_sdk/version.py +1 -1
- {langtrace_python_sdk-3.6.0.dist-info → langtrace_python_sdk-3.6.1.dist-info}/METADATA +1 -1
- {langtrace_python_sdk-3.6.0.dist-info → langtrace_python_sdk-3.6.1.dist-info}/RECORD +7 -7
- {langtrace_python_sdk-3.6.0.dist-info → langtrace_python_sdk-3.6.1.dist-info}/WHEEL +0 -0
- {langtrace_python_sdk-3.6.0.dist-info → langtrace_python_sdk-3.6.1.dist-info}/entry_points.txt +0 -0
- {langtrace_python_sdk-3.6.0.dist-info → langtrace_python_sdk-3.6.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,44 +1,31 @@
|
|
1
1
|
import json
|
2
|
-
from typing import Any,
|
3
|
-
|
4
|
-
|
5
|
-
SpanAttributes,
|
6
|
-
)
|
7
|
-
from langtrace_python_sdk.utils import set_span_attribute
|
8
|
-
from langtrace_python_sdk.utils.silently_fail import silently_fail
|
2
|
+
from typing import Any, Awaitable, Callable, Dict, List, Optional, Union
|
3
|
+
|
4
|
+
from langtrace.trace_attributes import LLMSpanAttributes, SpanAttributes
|
9
5
|
from opentelemetry import trace
|
10
|
-
from opentelemetry.trace import SpanKind, Tracer
|
11
|
-
from opentelemetry.trace.status import Status, StatusCode
|
6
|
+
from opentelemetry.trace import Span, SpanKind, Tracer
|
12
7
|
from opentelemetry.trace.propagation import set_span_in_context
|
13
|
-
from
|
14
|
-
SERVICE_PROVIDERS,
|
15
|
-
)
|
16
|
-
from langtrace_python_sdk.constants.instrumentation.openai import APIS
|
17
|
-
from langtrace_python_sdk.utils.llm import (
|
18
|
-
calculate_prompt_tokens,
|
19
|
-
get_base_url,
|
20
|
-
get_extra_attributes,
|
21
|
-
get_langtrace_attributes,
|
22
|
-
get_llm_request_attributes,
|
23
|
-
get_llm_url,
|
24
|
-
get_span_name,
|
25
|
-
get_tool_calls,
|
26
|
-
is_streaming,
|
27
|
-
set_event_completion,
|
28
|
-
StreamWrapper,
|
29
|
-
set_span_attributes,
|
30
|
-
set_usage_attributes,
|
31
|
-
)
|
32
|
-
from langtrace_python_sdk.types import NOT_GIVEN
|
8
|
+
from opentelemetry.trace.status import Status, StatusCode
|
33
9
|
|
10
|
+
from langtrace_python_sdk.constants.instrumentation.common import \
|
11
|
+
SERVICE_PROVIDERS
|
12
|
+
from langtrace_python_sdk.constants.instrumentation.openai import APIS
|
34
13
|
from langtrace_python_sdk.instrumentation.openai.types import (
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
14
|
+
ChatCompletionsCreateKwargs, ContentItem, EmbeddingsCreateKwargs,
|
15
|
+
ImagesEditKwargs, ImagesGenerateKwargs, ResultType)
|
16
|
+
from langtrace_python_sdk.types import NOT_GIVEN
|
17
|
+
from langtrace_python_sdk.utils import set_span_attribute
|
18
|
+
from langtrace_python_sdk.utils.llm import (StreamWrapper,
|
19
|
+
calculate_prompt_tokens,
|
20
|
+
get_base_url, get_extra_attributes,
|
21
|
+
get_langtrace_attributes,
|
22
|
+
get_llm_request_attributes,
|
23
|
+
get_llm_url, get_span_name,
|
24
|
+
get_tool_calls, is_streaming,
|
25
|
+
set_event_completion,
|
26
|
+
set_span_attributes,
|
27
|
+
set_usage_attributes)
|
28
|
+
from langtrace_python_sdk.utils.silently_fail import silently_fail
|
42
29
|
|
43
30
|
|
44
31
|
def filter_valid_attributes(attributes):
|
@@ -717,3 +704,8 @@ def _set_response_attributes(span: Span, result: ResultType) -> None:
|
|
717
704
|
SpanAttributes.LLM_USAGE_TOTAL_TOKENS,
|
718
705
|
result.usage.total_tokens,
|
719
706
|
)
|
707
|
+
set_span_attribute(
|
708
|
+
span,
|
709
|
+
"gen_ai.usage.cached_tokens",
|
710
|
+
result.usage.prompt_tokens_details.cached_tokens if result.usage.prompt_tokens_details else 0,
|
711
|
+
)
|
langtrace_python_sdk/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "3.6.
|
1
|
+
__version__ = "3.6.1"
|
@@ -113,7 +113,7 @@ examples/weaviate_example/__init__.py,sha256=8JMDBsRSEV10HfTd-YC7xb4txBjD3la56sn
|
|
113
113
|
examples/weaviate_example/query_text.py,sha256=wPHQTc_58kPoKTZMygVjTj-2ZcdrIuaausJfMxNQnQc,127162
|
114
114
|
langtrace_python_sdk/__init__.py,sha256=VZM6i71NR7pBQK6XvJWRelknuTYUhqwqE7PlicKa5Wg,1166
|
115
115
|
langtrace_python_sdk/langtrace.py,sha256=SeJdpry-dICKwytlzEovX33s-bJahGD5PTwpJb7dqVo,14618
|
116
|
-
langtrace_python_sdk/version.py,sha256=
|
116
|
+
langtrace_python_sdk/version.py,sha256=cNcutCkgy2XbuD3pgQjRV1bl4tH97bFnsC9W8BVzmHE,22
|
117
117
|
langtrace_python_sdk/constants/__init__.py,sha256=3CNYkWMdd1DrkGqzLUgNZXjdAlM6UFMlf_F-odAToyc,146
|
118
118
|
langtrace_python_sdk/constants/exporter/langtrace_exporter.py,sha256=EVCrouYCpY98f0KSaKr4PzNxPULTZZO6dSA_crEOyJU,106
|
119
119
|
langtrace_python_sdk/constants/instrumentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -214,7 +214,7 @@ langtrace_python_sdk/instrumentation/ollama/instrumentation.py,sha256=jdsvkqUJAA
|
|
214
214
|
langtrace_python_sdk/instrumentation/ollama/patch.py,sha256=w99r9wCCVDdJnZQEezYE2lW_iNFEtrldt9vq3ISAsag,5375
|
215
215
|
langtrace_python_sdk/instrumentation/openai/__init__.py,sha256=VPHRNCQEdkizIVP2d0Uw_a7t8XOTSTprEIB8oboJFbs,95
|
216
216
|
langtrace_python_sdk/instrumentation/openai/instrumentation.py,sha256=PZxI0qfoud1VsKGmJu49YDp0Z9z9TzCR8qxR3uznOMA,2810
|
217
|
-
langtrace_python_sdk/instrumentation/openai/patch.py,sha256=
|
217
|
+
langtrace_python_sdk/instrumentation/openai/patch.py,sha256=mRE150sHGL2dq4oOKTYWek1vup7HuRW_sqP6nNOd3N8,27862
|
218
218
|
langtrace_python_sdk/instrumentation/openai/types.py,sha256=aVkoa7tmAbYfyOhnyMrDaVjQuwhmRNLMthlNtKMtWX8,4311
|
219
219
|
langtrace_python_sdk/instrumentation/pinecone/__init__.py,sha256=DzXyGh9_MGWveJvXULkFwdkf7PbG2s3bAWtT1Dmz7Ok,99
|
220
220
|
langtrace_python_sdk/instrumentation/pinecone/instrumentation.py,sha256=HDXkRITrVPwdQEoOYJOfMzZE_2-vDDvuqHTlD8W1lQw,1845
|
@@ -285,8 +285,8 @@ tests/pinecone/cassettes/test_query.yaml,sha256=b5v9G3ssUy00oG63PlFUR3JErF2Js-5A
|
|
285
285
|
tests/pinecone/cassettes/test_upsert.yaml,sha256=neWmQ1v3d03V8WoLl8FoFeeCYImb8pxlJBWnFd_lITU,38607
|
286
286
|
tests/qdrant/conftest.py,sha256=9n0uHxxIjWk9fbYc4bx-uP8lSAgLBVx-cV9UjnsyCHM,381
|
287
287
|
tests/qdrant/test_qdrant.py,sha256=pzjAjVY2kmsmGfrI2Gs2xrolfuaNHz7l1fqGQCjp5_o,3353
|
288
|
-
langtrace_python_sdk-3.6.
|
289
|
-
langtrace_python_sdk-3.6.
|
290
|
-
langtrace_python_sdk-3.6.
|
291
|
-
langtrace_python_sdk-3.6.
|
292
|
-
langtrace_python_sdk-3.6.
|
288
|
+
langtrace_python_sdk-3.6.1.dist-info/METADATA,sha256=4HVLEEDH4ipygHf3va3OhB1kEMqcw8wqNGhbcjEt06A,15690
|
289
|
+
langtrace_python_sdk-3.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
290
|
+
langtrace_python_sdk-3.6.1.dist-info/entry_points.txt,sha256=1_b9-qvf2fE7uQNZcbUei9vLpFZBbbh9LrtGw95ssAo,70
|
291
|
+
langtrace_python_sdk-3.6.1.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
292
|
+
langtrace_python_sdk-3.6.1.dist-info/RECORD,,
|
File without changes
|
{langtrace_python_sdk-3.6.0.dist-info → langtrace_python_sdk-3.6.1.dist-info}/entry_points.txt
RENAMED
File without changes
|
{langtrace_python_sdk-3.6.0.dist-info → langtrace_python_sdk-3.6.1.dist-info}/licenses/LICENSE
RENAMED
File without changes
|