trodo-python 2.10.8__py3-none-any.whl → 2.10.9__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.
- trodo/__init__.py +1 -1
- trodo/otel/auto_instrument.py +49 -7
- {trodo_python-2.10.8.dist-info → trodo_python-2.10.9.dist-info}/METADATA +1 -1
- {trodo_python-2.10.8.dist-info → trodo_python-2.10.9.dist-info}/RECORD +6 -6
- {trodo_python-2.10.8.dist-info → trodo_python-2.10.9.dist-info}/WHEEL +0 -0
- {trodo_python-2.10.8.dist-info → trodo_python-2.10.9.dist-info}/top_level.txt +0 -0
trodo/__init__.py
CHANGED
trodo/otel/auto_instrument.py
CHANGED
|
@@ -45,9 +45,19 @@ def _trunc(s: Any, max_len: int) -> Optional[str]:
|
|
|
45
45
|
def _infer_kind(attrs: Dict[str, Any]) -> str:
|
|
46
46
|
if not attrs:
|
|
47
47
|
return "generic"
|
|
48
|
-
|
|
48
|
+
# Vercel AI SDK tool spans (`ai.toolCall`) carry ai.toolCall.name, not
|
|
49
|
+
# gen_ai.tool.name — without this they landed as 'generic'.
|
|
50
|
+
if attrs.get("gen_ai.tool.name") or attrs.get("ai.toolCall.name") or attrs.get("ai.functionCall.name"):
|
|
49
51
|
return "tool"
|
|
50
|
-
if
|
|
52
|
+
if (
|
|
53
|
+
attrs.get("gen_ai.operation.name")
|
|
54
|
+
or attrs.get("gen_ai.request.model")
|
|
55
|
+
or attrs.get("gen_ai.response.model")
|
|
56
|
+
or attrs.get("ai.model.id")
|
|
57
|
+
or attrs.get("ai.response.model")
|
|
58
|
+
or attrs.get("gen_ai.usage.input_tokens") is not None
|
|
59
|
+
or attrs.get("ai.usage.promptTokens") is not None
|
|
60
|
+
):
|
|
51
61
|
return "llm"
|
|
52
62
|
if attrs.get("db.system") or attrs.get("retrieval.query"):
|
|
53
63
|
return "retrieval"
|
|
@@ -178,20 +188,52 @@ def otel_span_to_trodo_span(otel_span: Any) -> Optional[TrodoSpan]:
|
|
|
178
188
|
attrs.get("gen_ai.usage.input_tokens")
|
|
179
189
|
or attrs.get("gen_ai.usage.prompt_tokens")
|
|
180
190
|
or attrs.get("llm.usage.prompt_tokens")
|
|
191
|
+
or attrs.get("ai.usage.promptTokens")
|
|
192
|
+
or attrs.get("ai.usage.inputTokens")
|
|
181
193
|
)
|
|
182
194
|
out_toks = (
|
|
183
195
|
attrs.get("gen_ai.usage.output_tokens")
|
|
184
196
|
or attrs.get("gen_ai.usage.completion_tokens")
|
|
185
197
|
or attrs.get("llm.usage.completion_tokens")
|
|
198
|
+
or attrs.get("ai.usage.completionTokens")
|
|
199
|
+
or attrs.get("ai.usage.outputTokens")
|
|
186
200
|
)
|
|
187
201
|
model = (
|
|
188
202
|
attrs.get("gen_ai.request.model")
|
|
189
203
|
or attrs.get("gen_ai.response.model")
|
|
190
204
|
or attrs.get("llm.request.model")
|
|
205
|
+
or attrs.get("ai.model.id")
|
|
206
|
+
or attrs.get("ai.response.model")
|
|
207
|
+
)
|
|
208
|
+
provider = attrs.get("gen_ai.system") or attrs.get("llm.vendor") or attrs.get("ai.model.provider")
|
|
209
|
+
# Vercel AI SDK uses the `ai.*` convention, NOT gen_ai.prompt/completion:
|
|
210
|
+
# ai.prompt.messages / ai.prompt (input), ai.response.text / ai.response.object
|
|
211
|
+
# (output), ai.toolCall.args / ai.toolCall.result (tool spans). Omitting these
|
|
212
|
+
# left input/output empty -> NULL in the DB -> nothing embedded or scored.
|
|
213
|
+
prompt = (
|
|
214
|
+
attrs.get("gen_ai.prompt")
|
|
215
|
+
or attrs.get("llm.prompts")
|
|
216
|
+
or attrs.get("ai.prompt")
|
|
217
|
+
or attrs.get("ai.prompt.messages")
|
|
218
|
+
or attrs.get("ai.toolCall.args")
|
|
219
|
+
or attrs.get("input.value")
|
|
220
|
+
)
|
|
221
|
+
completion = (
|
|
222
|
+
attrs.get("gen_ai.completion")
|
|
223
|
+
or attrs.get("llm.completion")
|
|
224
|
+
or attrs.get("ai.response.text")
|
|
225
|
+
or attrs.get("ai.response.object")
|
|
226
|
+
or attrs.get("ai.toolCall.result")
|
|
227
|
+
or attrs.get("output.value")
|
|
228
|
+
)
|
|
229
|
+
tool_name = (
|
|
230
|
+
attrs.get("gen_ai.tool.name")
|
|
231
|
+
or attrs.get("ai.toolCall.name")
|
|
232
|
+
or attrs.get("ai.functionCall.name")
|
|
191
233
|
)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
234
|
+
temperature = attrs.get("gen_ai.request.temperature")
|
|
235
|
+
if temperature is None:
|
|
236
|
+
temperature = attrs.get("ai.settings.temperature")
|
|
195
237
|
|
|
196
238
|
return TrodoSpan(
|
|
197
239
|
span_id=span_id,
|
|
@@ -212,8 +254,8 @@ def otel_span_to_trodo_span(otel_span: Any) -> Optional[TrodoSpan]:
|
|
|
212
254
|
provider=provider,
|
|
213
255
|
input_tokens=int(in_toks) if in_toks is not None else None,
|
|
214
256
|
output_tokens=int(out_toks) if out_toks is not None else None,
|
|
215
|
-
temperature=
|
|
216
|
-
tool_name=
|
|
257
|
+
temperature=temperature,
|
|
258
|
+
tool_name=tool_name,
|
|
217
259
|
input=prompt,
|
|
218
260
|
output=completion,
|
|
219
261
|
attributes=attrs or None,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
trodo/__init__.py,sha256=
|
|
1
|
+
trodo/__init__.py,sha256=C1zk-TLozRzrOUg23zjHKuR44cKhiM1vNEnYSvWugb8,18166
|
|
2
2
|
trodo/client.py,sha256=dhGiOJmxdWmXDDDabHN865_cAxttJs9LWPeDwEFbAwI,19107
|
|
3
3
|
trodo/types.py,sha256=eySgUvCXROG2TxtxgiU0MNr5iH0DEcduK8bmYtTKG44,3138
|
|
4
4
|
trodo/user_context.py,sha256=9la6azzwEanVmdP4ps_xMoufbeWVeIGU-M8ychmgajg,7859
|
|
@@ -12,7 +12,7 @@ trodo/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
12
12
|
trodo/managers/group_manager.py,sha256=ki3Se3qEoSZfREX63oeDeBmEfZF-ISHLE8azEtLg0tM,3542
|
|
13
13
|
trodo/managers/people_manager.py,sha256=mMVnx40Mlifx6NGgChvohC9ViK6dQu2mkXNHbV8pK1E,2882
|
|
14
14
|
trodo/otel/__init__.py,sha256=yiRFXWUU45bAM2CV37XeO7zf1hmnmjufdP4XO50yEyE,624
|
|
15
|
-
trodo/otel/auto_instrument.py,sha256=
|
|
15
|
+
trodo/otel/auto_instrument.py,sha256=ERAj60N9_Okmq3psZ7CF7dempez25Gsh7Zwf-cT-HLk,17882
|
|
16
16
|
trodo/otel/context.py,sha256=iJ1rE42-SbO8VZHAxhIl2ZJXgNwLIVps5xLg8GKgfFc,1165
|
|
17
17
|
trodo/otel/helpers.py,sha256=4HsjMOrE-7zuvaRSiGXxV7ZyfXQ5gLxtR3HdpLut9sk,20054
|
|
18
18
|
trodo/otel/processor.py,sha256=aqcTmzTw9cESgIp829pu_XCa5_dG_2MaeJNsqJZeqQU,7495
|
|
@@ -25,7 +25,7 @@ trodo/queue/event_queue.py,sha256=EVFZrhlq_kwC3jJ2GK0wMhHISf9UzLCZNDnT_aZ2I2A,87
|
|
|
25
25
|
trodo/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
26
|
trodo/session/server_session.py,sha256=McsudEiq33XDq3nqxgzBcUvIjQxCMscwEuAPnYXrTjs,2136
|
|
27
27
|
trodo/session/session_manager.py,sha256=JrgH1VeicmtlxPR4dXEuJbxhi23OelkgwW3-9Slv80o,2525
|
|
28
|
-
trodo_python-2.10.
|
|
29
|
-
trodo_python-2.10.
|
|
30
|
-
trodo_python-2.10.
|
|
31
|
-
trodo_python-2.10.
|
|
28
|
+
trodo_python-2.10.9.dist-info/METADATA,sha256=SMDqPlJivMYbIfWM7qRoRfH9HXmKT_XzAXnbK4F0uqs,20483
|
|
29
|
+
trodo_python-2.10.9.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
30
|
+
trodo_python-2.10.9.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
|
|
31
|
+
trodo_python-2.10.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|