langtrace-python-sdk 1.2.7__tar.gz → 1.2.8__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.8/LICENSE +201 -0
- langtrace_python_sdk-1.2.8/PKG-INFO +130 -0
- langtrace_python_sdk-1.2.8/README.md +102 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/pyproject.toml +2 -2
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/langchain_example/basic.py +28 -4
- langtrace_python_sdk-1.2.8/src/examples/openai/chat_completion.py +59 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/constants/instrumentation/common.py +2 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/anthropic/patch.py +5 -2
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/chroma/patch.py +6 -1
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain/patch.py +6 -1
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain_community/patch.py +6 -1
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain_core/patch.py +6 -1
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/llamaindex/patch.py +6 -1
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/openai/patch.py +22 -5
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/pinecone/patch.py +6 -1
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/langtrace.py +1 -0
- langtrace_python_sdk-1.2.8/src/langtrace_python_sdk/utils/with_root_span.py +65 -0
- langtrace_python_sdk-1.2.8/src/langtrace_python_sdk/version.py +1 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/run_example.py +5 -4
- langtrace_python_sdk-1.2.8/src/tests/__init__.py +0 -0
- langtrace_python_sdk-1.2.8/src/tests/chroma/test_chroma.py +58 -0
- langtrace_python_sdk-1.2.8/src/tests/openai/test_chat_completion.py +95 -0
- langtrace_python_sdk-1.2.8/src/tests/openai/test_image_generation.py +72 -0
- langtrace_python_sdk-1.2.8/src/tests/pinecone/test_pinecone.py +65 -0
- langtrace_python_sdk-1.2.8/src/tests/utils.py +17 -0
- langtrace_python_sdk-1.2.7/LICENSE +0 -661
- langtrace_python_sdk-1.2.7/PKG-INFO +0 -77
- langtrace_python_sdk-1.2.7/README.md +0 -49
- langtrace_python_sdk-1.2.7/src/examples/openai/chat_completion.py +0 -39
- langtrace_python_sdk-1.2.7/src/langtrace_python_sdk/utils/with_root_span.py +0 -33
- langtrace_python_sdk-1.2.7/src/langtrace_python_sdk/version.py +0 -1
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/.gitignore +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/anthropic_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/anthropic_example/completion.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/chroma_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/chroma_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/langchain_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/langchain_example/tool.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/llamaindex_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/llamaindex_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/llamaindex_example/data/abramov.txt +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/openai/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/openai/embeddings_create.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/openai/function_calling.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/openai/images_generate.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/pinecone_example/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/pinecone_example/basic.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/constants/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/constants/exporter/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/constants/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/constants/instrumentation/anthropic.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/constants/instrumentation/chroma.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/constants/instrumentation/openai.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/constants/instrumentation/pinecone.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/extensions/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/extensions/langtrace_exporter.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/anthropic/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/anthropic/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/chroma/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/chroma/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain_community/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain_community/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain_core/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/langchain_core/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/llamaindex/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/llamaindex/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/openai/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/openai/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/pinecone/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/instrumentation/pinecone/instrumentation.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/utils/__init__.py +0 -0
- {langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/langtrace_python_sdk/utils/llm.py +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: langtrace-python-sdk
|
|
3
|
+
Version: 1.2.8
|
|
4
|
+
Summary: Python SDK for LangTrace
|
|
5
|
+
Project-URL: Homepage, https://github.com/Scale3-Labs/langtrace-python-sdk
|
|
6
|
+
Author-email: Scale3 Labs <engineering@scale3labs.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Requires-Dist: opentelemetry-api
|
|
14
|
+
Requires-Dist: opentelemetry-instrumentation
|
|
15
|
+
Requires-Dist: opentelemetry-sdk
|
|
16
|
+
Requires-Dist: pinecone-client
|
|
17
|
+
Requires-Dist: tiktoken
|
|
18
|
+
Requires-Dist: trace-attributes
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: anthropic; extra == 'dev'
|
|
21
|
+
Requires-Dist: chromadb; extra == 'dev'
|
|
22
|
+
Requires-Dist: langchain; extra == 'dev'
|
|
23
|
+
Requires-Dist: langchain-openai; extra == 'dev'
|
|
24
|
+
Requires-Dist: llama-index; extra == 'dev'
|
|
25
|
+
Requires-Dist: openai; extra == 'dev'
|
|
26
|
+
Requires-Dist: python-dotenv; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# What is Langtrace?
|
|
30
|
+
|
|
31
|
+
Langtrace stands as a developer-centric, open-source solution, fully compatible with OpenTelemetry. It enables developers to effortlessly trace, monitor, and debug their LLM applications, offering robust support for automatic instrumentation.
|
|
32
|
+
|
|
33
|
+
## Supported LLM Modules
|
|
34
|
+
|
|
35
|
+
Langtrace supports a comprehensive range of LLMs, VectorDBs, and frameworks, ensuring wide coverage for your development needs:
|
|
36
|
+
|
|
37
|
+
### LLMs
|
|
38
|
+
|
|
39
|
+
1. OpenAI
|
|
40
|
+
2. Anthropic
|
|
41
|
+
3. Azure OpenAI
|
|
42
|
+
|
|
43
|
+
### VectorDBs
|
|
44
|
+
|
|
45
|
+
1. Pinecone
|
|
46
|
+
2. Chromadb
|
|
47
|
+
|
|
48
|
+
### Frameworks
|
|
49
|
+
|
|
50
|
+
1. LangChain
|
|
51
|
+
2. LlamaIndex
|
|
52
|
+
3. Haystack
|
|
53
|
+
|
|
54
|
+
We are actively working to extend our support to additional libraries!
|
|
55
|
+
|
|
56
|
+
## Getting Started
|
|
57
|
+
|
|
58
|
+
To begin utilizing Langtrace, follow these straightforward steps:
|
|
59
|
+
|
|
60
|
+
1. Install the package using `pip install langtrace-python-sdk`.
|
|
61
|
+
2. Incorporate Langtrace into your project with `from langtrace_python_sdk import langtrace`.
|
|
62
|
+
- This import should precede any other LLM module imports (such as OpenAI, LlamaIndex, etc.) to ensure proper functionality.
|
|
63
|
+
3. Initialize Langtrace by adding `langtrace.init({ write_to_remote_url: false})` to your code.
|
|
64
|
+
4. Congratulations, you've completed the basic setup! You will now begin to see traces from your LLM modules logged directly to the console.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
## Exporting Traces to Langtrace
|
|
68
|
+
|
|
69
|
+
To configure trace exporting, you have two options:
|
|
70
|
+
|
|
71
|
+
You'll need a Langtrace `api_key`, which can be acquired by logging into your Langtrace account.
|
|
72
|
+
|
|
73
|
+
1. Direct Initialization: Utilize `langtrace.init({ api_key: <YOUR_API_KEY>})`.
|
|
74
|
+
2. Environment Variables: Set `LANGTRACE_API_KEY`, then add `langtrace.init()` at the beginning of your file.
|
|
75
|
+
|
|
76
|
+
### Additional Customization
|
|
77
|
+
|
|
78
|
+
- `@with_langtrace_root_span` - this decorator is designed to organize and relate different spans, in a hierarchical manner. When you're performing multiple operations that you want to monitor together as a unit, this function helps by establishing a "parent" (`LangtraceRootSpan` or whatever is passed to `name`) span. Then, any calls to the LLM APIs made within the given function (fn) will be considered "children" of this parent span. This setup is especially useful for tracking the performance or behavior of a group of operations collectively, rather than individually.
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from langtrace_python_sdk.utils.with_root_span import with_langtrace_root_span
|
|
82
|
+
|
|
83
|
+
@with_langtrace_root_span()
|
|
84
|
+
def example():
|
|
85
|
+
response = client.chat.completions.create(
|
|
86
|
+
model="gpt-4",
|
|
87
|
+
messages=[{"role": "user", "content": "Say this is a test three times"}],
|
|
88
|
+
stream=False,
|
|
89
|
+
)
|
|
90
|
+
return response
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
- `with_additional_attributes` - this function is designed to enhance the traces by adding custom attributes to the current context. These custom attributes provide extra details about the operations being performed, making it easier to analyze and understand their behavior.
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from langtrace_python_sdk.utils.with_root_span import (
|
|
98
|
+
with_langtrace_root_span,
|
|
99
|
+
with_additional_attributes,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
@with_additional_attributes({"user.id": "1234", "user.feedback.rating": 1})
|
|
103
|
+
def api_call1():
|
|
104
|
+
response = client.chat.completions.create(
|
|
105
|
+
model="gpt-4",
|
|
106
|
+
messages=[{"role": "user", "content": "Say this is a test three times"}],
|
|
107
|
+
stream=False,
|
|
108
|
+
)
|
|
109
|
+
return response
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@with_additional_attributes({"user.id": "5678", "user.feedback.rating": -1})
|
|
113
|
+
def api_call2():
|
|
114
|
+
response = client.chat.completions.create(
|
|
115
|
+
model="gpt-4",
|
|
116
|
+
messages=[{"role": "user", "content": "Say this is a test three times"}],
|
|
117
|
+
stream=False,
|
|
118
|
+
)
|
|
119
|
+
return response
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@with_langtrace_root_span()
|
|
123
|
+
def chat_completion():
|
|
124
|
+
api_call1()
|
|
125
|
+
api_call2()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Langtrace Cloud
|
|
129
|
+
|
|
130
|
+
Currently under development 🚧
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# What is Langtrace?
|
|
2
|
+
|
|
3
|
+
Langtrace stands as a developer-centric, open-source solution, fully compatible with OpenTelemetry. It enables developers to effortlessly trace, monitor, and debug their LLM applications, offering robust support for automatic instrumentation.
|
|
4
|
+
|
|
5
|
+
## Supported LLM Modules
|
|
6
|
+
|
|
7
|
+
Langtrace supports a comprehensive range of LLMs, VectorDBs, and frameworks, ensuring wide coverage for your development needs:
|
|
8
|
+
|
|
9
|
+
### LLMs
|
|
10
|
+
|
|
11
|
+
1. OpenAI
|
|
12
|
+
2. Anthropic
|
|
13
|
+
3. Azure OpenAI
|
|
14
|
+
|
|
15
|
+
### VectorDBs
|
|
16
|
+
|
|
17
|
+
1. Pinecone
|
|
18
|
+
2. Chromadb
|
|
19
|
+
|
|
20
|
+
### Frameworks
|
|
21
|
+
|
|
22
|
+
1. LangChain
|
|
23
|
+
2. LlamaIndex
|
|
24
|
+
3. Haystack
|
|
25
|
+
|
|
26
|
+
We are actively working to extend our support to additional libraries!
|
|
27
|
+
|
|
28
|
+
## Getting Started
|
|
29
|
+
|
|
30
|
+
To begin utilizing Langtrace, follow these straightforward steps:
|
|
31
|
+
|
|
32
|
+
1. Install the package using `pip install langtrace-python-sdk`.
|
|
33
|
+
2. Incorporate Langtrace into your project with `from langtrace_python_sdk import langtrace`.
|
|
34
|
+
- This import should precede any other LLM module imports (such as OpenAI, LlamaIndex, etc.) to ensure proper functionality.
|
|
35
|
+
3. Initialize Langtrace by adding `langtrace.init({ write_to_remote_url: false})` to your code.
|
|
36
|
+
4. Congratulations, you've completed the basic setup! You will now begin to see traces from your LLM modules logged directly to the console.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Exporting Traces to Langtrace
|
|
40
|
+
|
|
41
|
+
To configure trace exporting, you have two options:
|
|
42
|
+
|
|
43
|
+
You'll need a Langtrace `api_key`, which can be acquired by logging into your Langtrace account.
|
|
44
|
+
|
|
45
|
+
1. Direct Initialization: Utilize `langtrace.init({ api_key: <YOUR_API_KEY>})`.
|
|
46
|
+
2. Environment Variables: Set `LANGTRACE_API_KEY`, then add `langtrace.init()` at the beginning of your file.
|
|
47
|
+
|
|
48
|
+
### Additional Customization
|
|
49
|
+
|
|
50
|
+
- `@with_langtrace_root_span` - this decorator is designed to organize and relate different spans, in a hierarchical manner. When you're performing multiple operations that you want to monitor together as a unit, this function helps by establishing a "parent" (`LangtraceRootSpan` or whatever is passed to `name`) span. Then, any calls to the LLM APIs made within the given function (fn) will be considered "children" of this parent span. This setup is especially useful for tracking the performance or behavior of a group of operations collectively, rather than individually.
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from langtrace_python_sdk.utils.with_root_span import with_langtrace_root_span
|
|
54
|
+
|
|
55
|
+
@with_langtrace_root_span()
|
|
56
|
+
def example():
|
|
57
|
+
response = client.chat.completions.create(
|
|
58
|
+
model="gpt-4",
|
|
59
|
+
messages=[{"role": "user", "content": "Say this is a test three times"}],
|
|
60
|
+
stream=False,
|
|
61
|
+
)
|
|
62
|
+
return response
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
- `with_additional_attributes` - this function is designed to enhance the traces by adding custom attributes to the current context. These custom attributes provide extra details about the operations being performed, making it easier to analyze and understand their behavior.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from langtrace_python_sdk.utils.with_root_span import (
|
|
70
|
+
with_langtrace_root_span,
|
|
71
|
+
with_additional_attributes,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
@with_additional_attributes({"user.id": "1234", "user.feedback.rating": 1})
|
|
75
|
+
def api_call1():
|
|
76
|
+
response = client.chat.completions.create(
|
|
77
|
+
model="gpt-4",
|
|
78
|
+
messages=[{"role": "user", "content": "Say this is a test three times"}],
|
|
79
|
+
stream=False,
|
|
80
|
+
)
|
|
81
|
+
return response
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@with_additional_attributes({"user.id": "5678", "user.feedback.rating": -1})
|
|
85
|
+
def api_call2():
|
|
86
|
+
response = client.chat.completions.create(
|
|
87
|
+
model="gpt-4",
|
|
88
|
+
messages=[{"role": "user", "content": "Say this is a test three times"}],
|
|
89
|
+
stream=False,
|
|
90
|
+
)
|
|
91
|
+
return response
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@with_langtrace_root_span()
|
|
95
|
+
def chat_completion():
|
|
96
|
+
api_call1()
|
|
97
|
+
api_call2()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Langtrace Cloud
|
|
101
|
+
|
|
102
|
+
Currently under development 🚧
|
|
@@ -11,10 +11,10 @@ dynamic = ["version"]
|
|
|
11
11
|
description = "Python SDK for LangTrace"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
authors = [{ name = "Scale3 Labs", email = "engineering@scale3labs.com" }]
|
|
14
|
-
license =
|
|
14
|
+
license = "Apache-2.0"
|
|
15
15
|
classifiers=[
|
|
16
16
|
"Programming Language :: Python :: 3",
|
|
17
|
-
"License :: OSI Approved ::
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
18
|
"Operating System :: OS Independent",
|
|
19
19
|
]
|
|
20
20
|
dependencies = [
|
{langtrace_python_sdk-1.2.7 → langtrace_python_sdk-1.2.8}/src/examples/langchain_example/basic.py
RENAMED
|
@@ -8,15 +8,18 @@ from langchain_core.runnables import RunnablePassthrough
|
|
|
8
8
|
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
|
|
9
9
|
|
|
10
10
|
from langtrace_python_sdk import langtrace
|
|
11
|
-
from langtrace_python_sdk.utils.with_root_span import
|
|
11
|
+
from langtrace_python_sdk.utils.with_root_span import (
|
|
12
|
+
with_langtrace_root_span,
|
|
13
|
+
with_additional_attributes,
|
|
14
|
+
)
|
|
12
15
|
|
|
13
16
|
_ = load_dotenv(find_dotenv())
|
|
14
17
|
|
|
15
|
-
langtrace.init(
|
|
18
|
+
langtrace.init()
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
@
|
|
19
|
-
def
|
|
21
|
+
@with_additional_attributes({"user.id": "1234", "user.feedback.rating": 1})
|
|
22
|
+
def api_call_1():
|
|
20
23
|
llm = ChatOpenAI()
|
|
21
24
|
prompt = ChatPromptTemplate.from_messages(
|
|
22
25
|
[
|
|
@@ -30,6 +33,27 @@ def basic():
|
|
|
30
33
|
print(res)
|
|
31
34
|
|
|
32
35
|
|
|
36
|
+
@with_additional_attributes({"user.id": "37373", "user.feedback.rating": 1})
|
|
37
|
+
def api_call_2():
|
|
38
|
+
llm = ChatOpenAI()
|
|
39
|
+
prompt = ChatPromptTemplate.from_messages(
|
|
40
|
+
[
|
|
41
|
+
("system", "You are world class technical documentation writer."),
|
|
42
|
+
("user", "{input}"),
|
|
43
|
+
]
|
|
44
|
+
)
|
|
45
|
+
output_parser = StrOutputParser()
|
|
46
|
+
chain = prompt | llm | output_parser
|
|
47
|
+
res = chain.invoke({"input": "how can langsmith help with testing?"})
|
|
48
|
+
print(res)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@with_langtrace_root_span()
|
|
52
|
+
def basic():
|
|
53
|
+
api_call_1()
|
|
54
|
+
api_call_2()
|
|
55
|
+
|
|
56
|
+
|
|
33
57
|
@with_langtrace_root_span()
|
|
34
58
|
def rag():
|
|
35
59
|
vectorstore = FAISS.from_texts(
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from dotenv import find_dotenv, load_dotenv
|
|
2
|
+
from openai import OpenAI
|
|
3
|
+
|
|
4
|
+
from langtrace_python_sdk import langtrace
|
|
5
|
+
from langtrace_python_sdk.utils.with_root_span import (
|
|
6
|
+
with_additional_attributes, with_langtrace_root_span)
|
|
7
|
+
|
|
8
|
+
_ = load_dotenv(find_dotenv())
|
|
9
|
+
|
|
10
|
+
langtrace.init()
|
|
11
|
+
client = OpenAI()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@with_additional_attributes({"user.id": "1234", "user.feedback.rating": 1})
|
|
15
|
+
def api1():
|
|
16
|
+
response = client.chat.completions.create(
|
|
17
|
+
model="gpt-4",
|
|
18
|
+
messages=[{"role": "user", "content": "Say this is a test three times"}],
|
|
19
|
+
stream=False,
|
|
20
|
+
)
|
|
21
|
+
return response
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@with_additional_attributes({"user.id": "5678", "user.feedback.rating": -1})
|
|
25
|
+
def api2():
|
|
26
|
+
response = client.chat.completions.create(
|
|
27
|
+
model="gpt-4",
|
|
28
|
+
messages=[{"role": "user", "content": "Say this is a test three times"}],
|
|
29
|
+
stream=False,
|
|
30
|
+
)
|
|
31
|
+
return response
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@with_langtrace_root_span()
|
|
35
|
+
def chat_completion():
|
|
36
|
+
response = api1()
|
|
37
|
+
response = api2()
|
|
38
|
+
return response
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# print(response)
|
|
42
|
+
# stream = client.chat.completions.create(
|
|
43
|
+
# model="gpt-4",
|
|
44
|
+
# messages=[{"role": "user", "content": "Say this is a test three times"}, {"role": "assistant", "content": "This is a test. This is a test. This is a test"},
|
|
45
|
+
# {"role": "user", "content": "Say this is a mock 4 times"}],
|
|
46
|
+
# stream=False,
|
|
47
|
+
# )
|
|
48
|
+
|
|
49
|
+
# result = []
|
|
50
|
+
# for chunk in response:
|
|
51
|
+
# if chunk.choices[0].delta.content is not None:
|
|
52
|
+
# content = [
|
|
53
|
+
# choice.delta.content if choice.delta and
|
|
54
|
+
# choice.delta.content else ""
|
|
55
|
+
# for choice in chunk.choices]
|
|
56
|
+
# result.append(
|
|
57
|
+
# content[0] if len(content) > 0 else "")
|
|
58
|
+
|
|
59
|
+
# print("".join(result))
|
|
@@ -4,12 +4,13 @@ This module contains the patching logic for the Anthropic library."""
|
|
|
4
4
|
import json
|
|
5
5
|
|
|
6
6
|
from langtrace.trace_attributes import Event, LLMSpanAttributes
|
|
7
|
+
from opentelemetry import baggage
|
|
7
8
|
from opentelemetry.trace import SpanKind
|
|
8
9
|
from opentelemetry.trace.status import Status, StatusCode
|
|
9
10
|
|
|
10
11
|
from langtrace_python_sdk.constants.instrumentation.anthropic import APIS
|
|
11
|
-
from langtrace_python_sdk.constants.instrumentation.common import
|
|
12
|
-
SERVICE_PROVIDERS
|
|
12
|
+
from langtrace_python_sdk.constants.instrumentation.common import (
|
|
13
|
+
LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY, SERVICE_PROVIDERS)
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def messages_create(original_method, version, tracer):
|
|
@@ -31,6 +32,7 @@ def messages_create(original_method, version, tracer):
|
|
|
31
32
|
prompts = json.dumps(
|
|
32
33
|
[{"role": "system", "content": system}] + kwargs.get("messages", [])
|
|
33
34
|
)
|
|
35
|
+
extra_attributes = baggage.get_baggage(LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY)
|
|
34
36
|
|
|
35
37
|
span_attributes = {
|
|
36
38
|
"langtrace.service.name": service_provider,
|
|
@@ -42,6 +44,7 @@ def messages_create(original_method, version, tracer):
|
|
|
42
44
|
"llm.model": kwargs.get("model"),
|
|
43
45
|
"llm.prompts": prompts,
|
|
44
46
|
"llm.stream": kwargs.get("stream"),
|
|
47
|
+
**(extra_attributes if extra_attributes is not None else {})
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
attributes = LLMSpanAttributes(**span_attributes)
|
|
@@ -3,11 +3,13 @@ This module contains the patching logic for the Chroma client.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from langtrace.trace_attributes import DatabaseSpanAttributes
|
|
6
|
+
from opentelemetry import baggage
|
|
6
7
|
from opentelemetry.trace import SpanKind
|
|
7
8
|
from opentelemetry.trace.status import Status, StatusCode
|
|
8
9
|
|
|
9
10
|
from langtrace_python_sdk.constants.instrumentation.chroma import APIS
|
|
10
|
-
from langtrace_python_sdk.constants.instrumentation.common import
|
|
11
|
+
from langtrace_python_sdk.constants.instrumentation.common import (
|
|
12
|
+
LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY, SERVICE_PROVIDERS)
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
def collection_patch(method, version, tracer):
|
|
@@ -18,6 +20,8 @@ def collection_patch(method, version, tracer):
|
|
|
18
20
|
def traced_method(wrapped, instance, args, kwargs):
|
|
19
21
|
api = APIS[method]
|
|
20
22
|
service_provider = SERVICE_PROVIDERS["CHROMA"]
|
|
23
|
+
extra_attributes = baggage.get_baggage(LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY)
|
|
24
|
+
|
|
21
25
|
span_attributes = {
|
|
22
26
|
"langtrace.service.name": service_provider,
|
|
23
27
|
"langtrace.service.type": "vectordb",
|
|
@@ -25,6 +29,7 @@ def collection_patch(method, version, tracer):
|
|
|
25
29
|
"langtrace.version": "1.0.0",
|
|
26
30
|
"db.system": "chromadb",
|
|
27
31
|
"db.operation": api["OPERATION"],
|
|
32
|
+
**(extra_attributes if extra_attributes is not None else {})
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
if hasattr(instance, "name") and instance.name is not None:
|
|
@@ -5,10 +5,12 @@ This module contains the patching logic for the langchain package.
|
|
|
5
5
|
import json
|
|
6
6
|
|
|
7
7
|
from langtrace.trace_attributes import FrameworkSpanAttributes
|
|
8
|
+
from opentelemetry import baggage
|
|
8
9
|
from opentelemetry.trace import SpanKind, StatusCode
|
|
9
10
|
from opentelemetry.trace.status import Status
|
|
10
11
|
|
|
11
|
-
from langtrace_python_sdk.constants.instrumentation.common import
|
|
12
|
+
from langtrace_python_sdk.constants.instrumentation.common import (
|
|
13
|
+
LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY, SERVICE_PROVIDERS)
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
def generic_patch(
|
|
@@ -20,12 +22,15 @@ def generic_patch(
|
|
|
20
22
|
|
|
21
23
|
def traced_method(wrapped, instance, args, kwargs):
|
|
22
24
|
service_provider = SERVICE_PROVIDERS["LANGCHAIN"]
|
|
25
|
+
extra_attributes = baggage.get_baggage(LANGTRACE_ADDITIONAL_SPAN_ATTRIBUTES_KEY)
|
|
26
|
+
|
|
23
27
|
span_attributes = {
|
|
24
28
|
"langtrace.service.name": service_provider,
|
|
25
29
|
"langtrace.service.type": "framework",
|
|
26
30
|
"langtrace.service.version": version,
|
|
27
31
|
"langtrace.version": "1.0.0",
|
|
28
32
|
"langchain.task.name": task,
|
|
33
|
+
**(extra_attributes if extra_attributes is not None else {})
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
if len(args) > 0 and trace_input:
|