langtrace-python-sdk 1.2.19__tar.gz → 1.2.21__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.
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/PKG-INFO +1 -1
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/openai/patch.py +21 -21
- langtrace_python_sdk-1.2.21/src/langtrace_python_sdk/version.py +1 -0
- langtrace_python_sdk-1.2.19/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/.gitignore +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/LICENSE +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/README.md +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/pyproject.toml +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/chat_completion.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/embeddings_create.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/function_calling.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/images_generate.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/constants/instrumentation/common.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/langtrace.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/utils/llm.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/run_example.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/langchain/test_langchain_community.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/langchain/test_langchain_core.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/utils.py +0 -0
|
@@ -194,9 +194,20 @@ def chat_completions_create(original_method, version, tracer):
|
|
|
194
194
|
span.end()
|
|
195
195
|
return result
|
|
196
196
|
else:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
)
|
|
197
|
+
# iterate over kwargs.get("messages", {}) and calculate the prompt tokens
|
|
198
|
+
prompt_tokens = 0
|
|
199
|
+
for message in kwargs.get("messages", {}):
|
|
200
|
+
prompt_tokens += calculate_prompt_tokens(
|
|
201
|
+
json.dumps(message), kwargs.get("model")
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
# iterate over kwargs.get("functions") and calculate the prompt tokens
|
|
205
|
+
if kwargs.get("functions") is not None:
|
|
206
|
+
for function in kwargs.get("functions"):
|
|
207
|
+
prompt_tokens += calculate_prompt_tokens(
|
|
208
|
+
json.dumps(function), kwargs.get("model")
|
|
209
|
+
)
|
|
210
|
+
|
|
200
211
|
return handle_streaming_response(
|
|
201
212
|
result,
|
|
202
213
|
span,
|
|
@@ -270,30 +281,19 @@ def chat_completions_create(original_method, version, tracer):
|
|
|
270
281
|
}
|
|
271
282
|
),
|
|
272
283
|
)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
284
|
+
span.set_attribute(
|
|
285
|
+
"llm.responses",
|
|
286
|
+
json.dumps(
|
|
287
|
+
[
|
|
277
288
|
{
|
|
278
289
|
"message": {
|
|
279
290
|
"role": "assistant",
|
|
280
291
|
"content": "".join(result_content),
|
|
281
292
|
}
|
|
282
293
|
}
|
|
283
|
-
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
span.set_attribute(
|
|
287
|
-
"llm.responses",
|
|
288
|
-
json.dumps(
|
|
289
|
-
{
|
|
290
|
-
"message": {
|
|
291
|
-
"role": "assistant",
|
|
292
|
-
"function_call": "".join(result_content),
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
),
|
|
296
|
-
)
|
|
294
|
+
]
|
|
295
|
+
),
|
|
296
|
+
)
|
|
297
297
|
span.set_status(StatusCode.OK)
|
|
298
298
|
span.end()
|
|
299
299
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.21"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.19"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/chroma_example/__init__.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/chroma_example/basic.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/langchain_example/basic.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/langchain_example/tool.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/llamaindex_example/basic.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/chat_completion.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/embeddings_create.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/function_calling.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/openai/images_generate.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/examples/pinecone_example/basic.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/__init__.py
RENAMED
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/langtrace.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/langtrace_python_sdk/utils/llm.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/anthropic/test_anthropic.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/langchain/test_langchain.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/openai/test_chat_completion.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.19 → langtrace_python_sdk-1.2.21}/src/tests/pinecone/test_pinecone.py
RENAMED
|
File without changes
|
|
File without changes
|