langtrace-python-sdk 1.2.18__tar.gz → 1.2.20__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.18 → langtrace_python_sdk-1.2.20}/PKG-INFO +1 -1
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/openai/patch.py +17 -4
- langtrace_python_sdk-1.2.20/src/langtrace_python_sdk/version.py +1 -0
- langtrace_python_sdk-1.2.18/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/.gitignore +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/LICENSE +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/README.md +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/pyproject.toml +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/langchain_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/chat_completion.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/embeddings_create.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/function_calling.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/images_generate.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/constants/instrumentation/common.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/langtrace.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/utils/llm.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/utils/with_root_span.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/run_example.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/__init__.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/anthropic/test_anthropic.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/chroma/test_chroma.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/langchain/test_langchain.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/langchain/test_langchain_community.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/langchain/test_langchain_core.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/openai/test_chat_completion.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/openai/test_image_generation.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/pinecone/test_pinecone.py +0 -0
- {langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/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,
|
|
@@ -219,6 +230,8 @@ def chat_completions_create(original_method, version, tracer):
|
|
|
219
230
|
completion_tokens = 0
|
|
220
231
|
try:
|
|
221
232
|
for chunk in result:
|
|
233
|
+
if hasattr(chunk, "model") and chunk.model is not None:
|
|
234
|
+
span.set_attribute("llm.model", chunk.model)
|
|
222
235
|
if hasattr(chunk, "choices") and chunk.choices is not None:
|
|
223
236
|
token_counts = [
|
|
224
237
|
(
|
|
@@ -287,7 +300,7 @@ def chat_completions_create(original_method, version, tracer):
|
|
|
287
300
|
{
|
|
288
301
|
"message": {
|
|
289
302
|
"role": "assistant",
|
|
290
|
-
"
|
|
303
|
+
"content": "".join(result_content),
|
|
291
304
|
}
|
|
292
305
|
}
|
|
293
306
|
),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.2.20"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.18"
|
|
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.18 → langtrace_python_sdk-1.2.20}/src/examples/chroma_example/__init__.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/chroma_example/basic.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/langchain_example/basic.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/langchain_example/tool.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/llamaindex_example/basic.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/chat_completion.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/embeddings_create.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/function_calling.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/openai/images_generate.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/examples/pinecone_example/basic.py
RENAMED
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/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.18 → langtrace_python_sdk-1.2.20}/src/langtrace_python_sdk/langtrace.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/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.18 → langtrace_python_sdk-1.2.20}/src/tests/anthropic/test_anthropic.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/langchain/test_langchain.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/openai/test_chat_completion.py
RENAMED
|
File without changes
|
|
File without changes
|
{langtrace_python_sdk-1.2.18 → langtrace_python_sdk-1.2.20}/src/tests/pinecone/test_pinecone.py
RENAMED
|
File without changes
|
|
File without changes
|