arize-phoenix 5.11.0__py3-none-any.whl → 6.0.0__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.
Potentially problematic release.
This version of arize-phoenix might be problematic. Click here for more details.
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-6.0.0.dist-info}/METADATA +1 -1
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-6.0.0.dist-info}/RECORD +26 -26
- phoenix/experiments/evaluators/llm_evaluators.py +2 -2
- phoenix/server/api/helpers/dataset_helpers.py +77 -40
- phoenix/server/api/helpers/playground_clients.py +40 -78
- phoenix/server/api/helpers/playground_spans.py +2 -1
- phoenix/server/api/mutations/chat_mutations.py +9 -4
- phoenix/server/api/mutations/dataset_mutations.py +10 -30
- phoenix/server/api/routers/v1/evaluations.py +1 -1
- phoenix/server/api/subscriptions.py +52 -13
- phoenix/server/api/types/Span.py +12 -49
- phoenix/server/api/types/TemplateLanguage.py +1 -0
- phoenix/server/static/.vite/manifest.json +31 -31
- phoenix/server/static/assets/{components-C_HASv83.js → components-Bo-xjXoV.js} +144 -144
- phoenix/server/static/assets/index-i2KbnOZd.js +101 -0
- phoenix/server/static/assets/{pages-DYHcAdjT.js → pages-BfYVoiUE.js} +326 -299
- phoenix/server/static/assets/{vendor-BCxsh5i3.js → vendor-UNccFYqq.js} +2 -2
- phoenix/server/static/assets/{vendor-arizeai-C2CDZgMz.js → vendor-arizeai-gSIqhzZY.js} +9 -9
- phoenix/server/static/assets/{vendor-codemirror-DYbtnCTn.js → vendor-codemirror-fSYjW3f-.js} +1 -1
- phoenix/server/static/assets/{vendor-recharts-P6W8G0Mb.js → vendor-recharts-CVVyA2X0.js} +1 -1
- phoenix/utilities/template_formatters.py +18 -0
- phoenix/version.py +1 -1
- phoenix/server/static/assets/index-D7UiCRtr.js +0 -101
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-6.0.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-6.0.0.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-6.0.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-6.0.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,7 +6,7 @@ phoenix/exceptions.py,sha256=n2L2KKuecrdflB9MsCdAYCiSEvGJptIsfRkXMoJle7A,169
|
|
|
6
6
|
phoenix/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
7
7
|
phoenix/services.py,sha256=kpW1WL0kiB8XJsO6XycvZVJ-lBkNoenhQ7atCvBoSe8,5365
|
|
8
8
|
phoenix/settings.py,sha256=ht-0oN-sMV6SPXrk7Tu1EZlngpAYkGNLYPhO8DyrdQI,661
|
|
9
|
-
phoenix/version.py,sha256=
|
|
9
|
+
phoenix/version.py,sha256=eSyQRXyZR8d0tJQPRLwDd_1tXyRgb7TUvtlI-hfN620,22
|
|
10
10
|
phoenix/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
phoenix/core/embedding_dimension.py,sha256=zKGbcvwOXgLf-yrJBpQyKtd-LEOPRKHnUToyAU8Owis,87
|
|
12
12
|
phoenix/core/model.py,sha256=qBFraOtmwCCnWJltKNP18DDG0mULXigytlFsa6YOz6k,4837
|
|
@@ -47,7 +47,7 @@ phoenix/experiments/utils.py,sha256=MZ1-OnTcavk_KUtbfGqt55Fk9TGtJpYG_K71WsN-zDk,
|
|
|
47
47
|
phoenix/experiments/evaluators/__init__.py,sha256=j63fi3fa3U7-itVPHa82GowhjQRU-wO6yhO34u_lhsA,714
|
|
48
48
|
phoenix/experiments/evaluators/base.py,sha256=zefFLqyYLMxJnZxDs1S0QCrnb43YJraoadCMqRMU72A,5576
|
|
49
49
|
phoenix/experiments/evaluators/code_evaluators.py,sha256=JIu_8GezA3UKA7isUmZvBxjcJeXllIDESEgdF2zeDck,6755
|
|
50
|
-
phoenix/experiments/evaluators/llm_evaluators.py,sha256=
|
|
50
|
+
phoenix/experiments/evaluators/llm_evaluators.py,sha256=1HsZQsKNWA_19EHrjI6OXqm1aBwvIKS-qHYc3R0bOqc,20551
|
|
51
51
|
phoenix/experiments/evaluators/utils.py,sha256=W-k2bHL67ST-B7ne8t5LvCFHGBaKCPHbOv3x1SlDENU,9330
|
|
52
52
|
phoenix/inferences/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
53
|
phoenix/inferences/errors.py,sha256=AOsCs-xR1LV469Gygje16EOK3qGheiPGW0Ylg-MakhQ,8282
|
|
@@ -94,7 +94,7 @@ phoenix/server/api/exceptions.py,sha256=TA0JuY2YRnj35qGuMSQ8d0ToHum9gWm9W--3fSKH
|
|
|
94
94
|
phoenix/server/api/interceptor.py,sha256=ykDnoC_apUd-llVli3m1CW18kNSIgjz2qZ6m5JmPDu8,1294
|
|
95
95
|
phoenix/server/api/queries.py,sha256=4KJz8TUz3VUTup9MDjr_GoKX0SttWSvHBq2ncWZGxf8,27343
|
|
96
96
|
phoenix/server/api/schema.py,sha256=tHyw2jTbue_-gu0fe9Sw7LUYtzJUCwp9SvccDgOkNPw,1696
|
|
97
|
-
phoenix/server/api/subscriptions.py,sha256=
|
|
97
|
+
phoenix/server/api/subscriptions.py,sha256=nsiByh2rTPc1PS7OrPyuyyfFfYUUXeGmai19IfYP0dA,23201
|
|
98
98
|
phoenix/server/api/utils.py,sha256=quCBRcusc6PUq9tJq7M8PgwFZp7nXgVAxtbw8feribY,833
|
|
99
99
|
phoenix/server/api/dataloaders/__init__.py,sha256=jNYvfXjnZzgA2HWTG7AZdqWGla3ZysBUDUei8Zkz6N8,3290
|
|
100
100
|
phoenix/server/api/dataloaders/annotation_summaries.py,sha256=2sHmIDX7n8tuPeBTs9bMKtlMKWn_Ph9awTZqmwn2Owc,5505
|
|
@@ -124,10 +124,10 @@ phoenix/server/api/dataloaders/users.py,sha256=Uh86Kny_xpqDdEvEklcTBUA_MELgu4Z0j
|
|
|
124
124
|
phoenix/server/api/dataloaders/cache/__init__.py,sha256=SYoOM9n8FJaMdQarma5d1blu-jIg2GB8Shqg5ezSzZ8,106
|
|
125
125
|
phoenix/server/api/dataloaders/cache/two_tier_cache.py,sha256=cmo8FUT3E91R139IEzh4yCga-6nTamc5KPXAfMrzNDM,2315
|
|
126
126
|
phoenix/server/api/helpers/__init__.py,sha256=m2-xaSPqUiSs91k62JaRDjFNfl-1byxBfY-m_Vxw16U,272
|
|
127
|
-
phoenix/server/api/helpers/dataset_helpers.py,sha256=
|
|
128
|
-
phoenix/server/api/helpers/playground_clients.py,sha256=
|
|
127
|
+
phoenix/server/api/helpers/dataset_helpers.py,sha256=AMlKY9_e0wnTrTSSQemM5NHfnpwARSytx-m9YK6f6bY,8421
|
|
128
|
+
phoenix/server/api/helpers/playground_clients.py,sha256=zgpYRn7c8Yi6-0ZW7miKTDKnKor9nq4U40-mjgtqIGY,36164
|
|
129
129
|
phoenix/server/api/helpers/playground_registry.py,sha256=CPLMziFB2wmr-dfbx7VbzO2f8YIG_k5RftzvGXYGQ1w,2570
|
|
130
|
-
phoenix/server/api/helpers/playground_spans.py,sha256=
|
|
130
|
+
phoenix/server/api/helpers/playground_spans.py,sha256=qGk7V7IZK7EkRE1mvZyROpLN5kgOahOZifFzUWmqYFc,16546
|
|
131
131
|
phoenix/server/api/input_types/AddExamplesToDatasetInput.py,sha256=mIQz0S_z8YdrktKIY6RCvtNJ2yZF9pYvTGgasUsI-54,430
|
|
132
132
|
phoenix/server/api/input_types/AddSpansToDatasetInput.py,sha256=-StSstyMAVrba3tG1U30b-srkKCtu_svflQuSM19iJA,362
|
|
133
133
|
phoenix/server/api/input_types/ChatCompletionInput.py,sha256=g_5ARuwylt-uCVAsGyZPEVtidEQiOhbKakvDQsZumzw,1451
|
|
@@ -164,8 +164,8 @@ phoenix/server/api/input_types/UserRoleInput.py,sha256=xxhFe0ITZOgRVEJbVem_W6F1I
|
|
|
164
164
|
phoenix/server/api/input_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
165
165
|
phoenix/server/api/mutations/__init__.py,sha256=1wClieLNA3_Tin4Ah67rkrQvwSSZAdPU0EPsRiUxyAA,1103
|
|
166
166
|
phoenix/server/api/mutations/api_key_mutations.py,sha256=OmPipsmlQIb6DKvAgO58mZUwkYJihlJB2N4lTyeUlAA,6164
|
|
167
|
-
phoenix/server/api/mutations/chat_mutations.py,sha256=
|
|
168
|
-
phoenix/server/api/mutations/dataset_mutations.py,sha256=
|
|
167
|
+
phoenix/server/api/mutations/chat_mutations.py,sha256=YUZGgoUoA-652UVo5p7qWNnN4u7tdU6XfhDnTIxvbqU,22831
|
|
168
|
+
phoenix/server/api/mutations/dataset_mutations.py,sha256=OkVek-GtDf_1eloI7Sdz6W6l5FFmwU_41LJM8-fw3q4,26088
|
|
169
169
|
phoenix/server/api/mutations/experiment_mutations.py,sha256=p3CoLAa8nFPa3D759Y2A7De_PVJNGOL98mA3HoZBrRQ,3188
|
|
170
170
|
phoenix/server/api/mutations/export_events_mutations.py,sha256=xoDnVWC7eA_8wNQP0-oyiHojyUZ0EhVVSrsAnztetC0,3993
|
|
171
171
|
phoenix/server/api/mutations/project_mutations.py,sha256=KdcA3c6tgLZ8QhpIv37qJESTBPxs56SbfeYdDKzU7-8,2263
|
|
@@ -182,7 +182,7 @@ phoenix/server/api/routers/oauth2.py,sha256=bSrTZAAWW4WgZVwkr39xbo5jZEYL4w4wCbEe
|
|
|
182
182
|
phoenix/server/api/routers/utils.py,sha256=M41BoH-fl37izhRuN2aX7lWm7jOC20A_3uClv9TVUUY,583
|
|
183
183
|
phoenix/server/api/routers/v1/__init__.py,sha256=aLEHzzU8kQo4Oqsv2an35lH5VYUxAZQrcG7CXZA_Lx4,2214
|
|
184
184
|
phoenix/server/api/routers/v1/datasets.py,sha256=tNh0CxAvSkWh-_5AwisGN1degQlUNGU3uufGa7MIbOw,36985
|
|
185
|
-
phoenix/server/api/routers/v1/evaluations.py,sha256=
|
|
185
|
+
phoenix/server/api/routers/v1/evaluations.py,sha256=RpOkTylp5Da6BvPZGuN8ksnxz_BVXRIwyOvwX9Iko8U,12647
|
|
186
186
|
phoenix/server/api/routers/v1/experiment_evaluations.py,sha256=1XuKqE5F6CC6R4kF4g4YdBtcYvch1rCk8Am5CGyqfJ4,4838
|
|
187
187
|
phoenix/server/api/routers/v1/experiment_runs.py,sha256=xKXhol1-G4zAFECAQK9lAjKtSJsvB0Bp6bAXJYqJ7eI,6387
|
|
188
188
|
phoenix/server/api/routers/v1/experiments.py,sha256=sBxOIE4k4eIt-sQ6lPo2HUv9Tf1aURXtTJTq8J-Rfto,11808
|
|
@@ -241,10 +241,10 @@ phoenix/server/api/types/Retrieval.py,sha256=OhMK2ncjoyp5h1yjKhjlKpoTbQrMHuxmgSF
|
|
|
241
241
|
phoenix/server/api/types/ScalarDriftMetricEnum.py,sha256=IUAcRPpgL41WdoIgK6cNk2Te38SspXGyEs-S1fY23_A,232
|
|
242
242
|
phoenix/server/api/types/Segments.py,sha256=vT2v0efoa5cuBKxLtxTnsUP5YJJCZfTloM71Spu0tMI,2915
|
|
243
243
|
phoenix/server/api/types/SortDir.py,sha256=OUpXhlCzCxPoXSDkJJygEs9Rw9pMymfaZUG5zPTrw4Y,152
|
|
244
|
-
phoenix/server/api/types/Span.py,sha256=
|
|
244
|
+
phoenix/server/api/types/Span.py,sha256=wJGvenSL6d1oDmpJt4hsLjIVTxmemJBRCBKHy4rYztc,15355
|
|
245
245
|
phoenix/server/api/types/SpanAnnotation.py,sha256=6b5G-b_OoRvDL2ayWk7MkbqarLK-F-pQMx21CpUuNGY,1168
|
|
246
246
|
phoenix/server/api/types/SystemApiKey.py,sha256=2ym8EgsTBIvxx1l9xZ-2YMovz58ZwYb_MaHBTJ9NH2E,166
|
|
247
|
-
phoenix/server/api/types/TemplateLanguage.py,sha256=
|
|
247
|
+
phoenix/server/api/types/TemplateLanguage.py,sha256=6j_0uwO_GZIeCpR7sTOnxySXudT7qBSC6LFsjzbvW1o,160
|
|
248
248
|
phoenix/server/api/types/TimeSeries.py,sha256=IIeGVRFdSMozYXxPg736DW_mKvj4-3WjYSYEnn4UEJc,5241
|
|
249
249
|
phoenix/server/api/types/Trace.py,sha256=1RrdEedlPpNmWkQwosOZ81fabc9-B6PDHTYpr-hZj-Y,3240
|
|
250
250
|
phoenix/server/api/types/TraceAnnotation.py,sha256=OW6A2zr1gomOuG0XQe55dk15XXX2DSM0DzatRbHWH5A,1256
|
|
@@ -273,15 +273,15 @@ phoenix/server/static/apple-touch-icon-76x76.png,sha256=CT_xT12I0u2i0WU8JzBZBuOQ
|
|
|
273
273
|
phoenix/server/static/apple-touch-icon.png,sha256=fOfpjqGpWYbJ0eAurKsyoZP1EAs6ZVooBJ_SGk2ZkDs,3801
|
|
274
274
|
phoenix/server/static/favicon.ico,sha256=bY0vvCKRftemZfPShwZtE93DiiQdaYaozkPGwNFr6H8,34494
|
|
275
275
|
phoenix/server/static/modernizr.js,sha256=mvK-XtkNqjOral-QvzoqsyOMECXIMu5BQwSVN_wcU9c,2564
|
|
276
|
-
phoenix/server/static/.vite/manifest.json,sha256=
|
|
277
|
-
phoenix/server/static/assets/components-
|
|
278
|
-
phoenix/server/static/assets/index-
|
|
279
|
-
phoenix/server/static/assets/pages-
|
|
280
|
-
phoenix/server/static/assets/vendor-BCxsh5i3.js,sha256=fPeA9hYHGj1n2Bg8JOlpsddXw7Vkulbvra3z4RCy0Ss,10899238
|
|
276
|
+
phoenix/server/static/.vite/manifest.json,sha256=I8csmeLbMfXrOtIwIEqwR8H9yF364xgi1vt-F7T2DvE,1929
|
|
277
|
+
phoenix/server/static/assets/components-Bo-xjXoV.js,sha256=-zGBOrc-bOd4e9dKbaw__9lCm8wNu1W-UROzW9UoXR4,312092
|
|
278
|
+
phoenix/server/static/assets/index-i2KbnOZd.js,sha256=E8LWCCrBJl_AwuE2eVr3JU-tzQM9u9GWRBgjBXptjMc,8305
|
|
279
|
+
phoenix/server/static/assets/pages-BfYVoiUE.js,sha256=UKyvB-BB5eyPwrYLIDc1ZN_HsdSs_7CnB7Q_5ddtixk,633454
|
|
281
280
|
phoenix/server/static/assets/vendor-DxkFTwjz.css,sha256=nZrkr0u6NNElFGvpWHk9GTHeGoibCXCli1bE7mXZGZg,1816
|
|
282
|
-
phoenix/server/static/assets/vendor-
|
|
283
|
-
phoenix/server/static/assets/vendor-
|
|
284
|
-
phoenix/server/static/assets/vendor-
|
|
281
|
+
phoenix/server/static/assets/vendor-UNccFYqq.js,sha256=vzJ1ZI0VHzIhXJyu35Z8nG2iFAk2oq_u_1IE_h4ZovY,10899274
|
|
282
|
+
phoenix/server/static/assets/vendor-arizeai-gSIqhzZY.js,sha256=p5nkI7UHuepmzGlED1HiNeSRCFKtZx4yD9i4C5NC6po,308489
|
|
283
|
+
phoenix/server/static/assets/vendor-codemirror-fSYjW3f-.js,sha256=R0vjkRdXIPclHQMbu_0vy9EUfMwOYoH7iejIOgl3CT4,392709
|
|
284
|
+
phoenix/server/static/assets/vendor-recharts-CVVyA2X0.js,sha256=ApyczsmduDBWHOZ0KyZqKT7rL3fDMtCyzor77olD9MA,282859
|
|
285
285
|
phoenix/server/static/assets/vendor-three-DwGkEfCM.js,sha256=0D12ZgKzfKCTSdSTKJBFR2RZO_xxeMXrqDp0AszZqHY,620972
|
|
286
286
|
phoenix/server/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
287
287
|
phoenix/server/templates/index.html,sha256=ram6sfy2obf_F053ay35V30v-mnRWZ86rK-PstXLy1c,4457
|
|
@@ -321,10 +321,10 @@ phoenix/utilities/logging.py,sha256=NKvX43jWITgSTtHGCi6l5xp8jTjtQ8FQ_irEi9ybOxg,
|
|
|
321
321
|
phoenix/utilities/project.py,sha256=auVpARXkDb-JgeX5f2aStyFIkeKvGwN9l7qrFeJMVxI,445
|
|
322
322
|
phoenix/utilities/re.py,sha256=x8Xbk-Wa6qDMAtUd_7JtZvKtrYEuMY-bchB0n163_5c,2006
|
|
323
323
|
phoenix/utilities/span_store.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
324
|
-
phoenix/utilities/template_formatters.py,sha256=
|
|
325
|
-
arize_phoenix-
|
|
326
|
-
arize_phoenix-
|
|
327
|
-
arize_phoenix-
|
|
328
|
-
arize_phoenix-
|
|
329
|
-
arize_phoenix-
|
|
330
|
-
arize_phoenix-
|
|
324
|
+
phoenix/utilities/template_formatters.py,sha256=gh9PJD6WEGw7TEYXfSst1UR4pWWwmjxMLrDVQ_CkpkQ,2779
|
|
325
|
+
arize_phoenix-6.0.0.dist-info/METADATA,sha256=0q5IT7ux_4-FeqEvPjOWWki0udeqWvINeKA39rlC-BA,22670
|
|
326
|
+
arize_phoenix-6.0.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
327
|
+
arize_phoenix-6.0.0.dist-info/entry_points.txt,sha256=Pgpn8Upxx9P8z8joPXZWl2LlnAlGc3gcQoVchb06X1Q,94
|
|
328
|
+
arize_phoenix-6.0.0.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
|
|
329
|
+
arize_phoenix-6.0.0.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
|
|
330
|
+
arize_phoenix-6.0.0.dist-info/RECORD,,
|
|
@@ -232,7 +232,7 @@ class RelevanceEvaluator(LLMEvaluator):
|
|
|
232
232
|
"query. First, explain step-by-step why you think the text is or is not relevant. "
|
|
233
233
|
"Then provide a single word label; 'true' if the text is relevant or 'false' if the text "
|
|
234
234
|
"is not relevant. "
|
|
235
|
-
"Here is an example template for your
|
|
235
|
+
"Here is an example template for your response:\n\n"
|
|
236
236
|
"CRITERIA: the response is 'relevant' to the query\n"
|
|
237
237
|
"QUERY: *text that contains a query*\n"
|
|
238
238
|
"RESPONSE: *a response that may or may not be relevant to the query*\n"
|
|
@@ -367,7 +367,7 @@ class LLMRelationalEvaluator(LLMEvaluator):
|
|
|
367
367
|
"First, explain step-by-step why you think the response '{relation}' the reference. "
|
|
368
368
|
"Then provide a single word label; 'true' if the response '{relation}' the reference or "
|
|
369
369
|
"'false' if the text is not '{relation}' to the reference. "
|
|
370
|
-
"Here is an example template for your
|
|
370
|
+
"Here is an example template for your response:\n\n"
|
|
371
371
|
"CRITERIA: the response '{relation}' the reference\n"
|
|
372
372
|
"REFERENCE: *text that contains a reference*\n"
|
|
373
373
|
"RESPONSE: *a response that may or may not be '{relation}' to the reference*\n"
|
|
@@ -1,54 +1,43 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from collections.abc import Mapping
|
|
3
|
-
from typing import Any, Literal, Optional
|
|
3
|
+
from typing import Any, Literal, Optional
|
|
4
4
|
|
|
5
5
|
from openinference.semconv.trace import (
|
|
6
6
|
MessageAttributes,
|
|
7
7
|
OpenInferenceMimeTypeValues,
|
|
8
8
|
OpenInferenceSpanKindValues,
|
|
9
|
+
SpanAttributes,
|
|
9
10
|
ToolCallAttributes,
|
|
10
11
|
)
|
|
11
12
|
|
|
13
|
+
from phoenix.db.models import Span
|
|
12
14
|
from phoenix.trace.attributes import get_attribute_value
|
|
13
15
|
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
"""
|
|
17
|
-
An interface that contains the information needed to extract dataset example
|
|
18
|
-
input and output values from a span.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
span_kind: Optional[str]
|
|
22
|
-
input_value: Any
|
|
23
|
-
input_mime_type: Optional[str]
|
|
24
|
-
output_value: Any
|
|
25
|
-
output_mime_type: Optional[str]
|
|
26
|
-
llm_prompt_template_variables: Any
|
|
27
|
-
llm_input_messages: Any
|
|
28
|
-
llm_output_messages: Any
|
|
29
|
-
retrieval_documents: Any
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def get_dataset_example_input(span: HasSpanIO) -> dict[str, Any]:
|
|
17
|
+
def get_dataset_example_input(span: Span) -> dict[str, Any]:
|
|
33
18
|
"""
|
|
34
19
|
Extracts the input value from a span and returns it as a dictionary. Input
|
|
35
20
|
values from LLM spans are extracted from the input messages and prompt
|
|
36
21
|
template variables (if present). For other span kinds, the input is
|
|
37
22
|
extracted from the input value and input mime type attributes.
|
|
38
23
|
"""
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
span_kind = span.span_kind
|
|
25
|
+
attributes = span.attributes
|
|
26
|
+
input_value = get_attribute_value(attributes, INPUT_VALUE)
|
|
27
|
+
input_mime_type = get_attribute_value(attributes, INPUT_MIME_TYPE)
|
|
28
|
+
prompt_template_variables = get_attribute_value(attributes, LLM_PROMPT_TEMPLATE_VARIABLES)
|
|
29
|
+
input_messages = get_attribute_value(attributes, LLM_INPUT_MESSAGES)
|
|
30
|
+
if span_kind == LLM:
|
|
42
31
|
return _get_llm_span_input(
|
|
43
|
-
input_messages=
|
|
32
|
+
input_messages=input_messages,
|
|
44
33
|
input_value=input_value,
|
|
45
34
|
input_mime_type=input_mime_type,
|
|
46
|
-
prompt_template_variables=
|
|
35
|
+
prompt_template_variables=prompt_template_variables,
|
|
47
36
|
)
|
|
48
37
|
return _get_generic_io_value(io_value=input_value, mime_type=input_mime_type, kind="input")
|
|
49
38
|
|
|
50
39
|
|
|
51
|
-
def get_dataset_example_output(span:
|
|
40
|
+
def get_dataset_example_output(span: Span) -> dict[str, Any]:
|
|
52
41
|
"""
|
|
53
42
|
Extracts the output value from a span and returns it as a dictionary. Output
|
|
54
43
|
values from LLM spans are extracted from the output messages (if present).
|
|
@@ -56,18 +45,21 @@ def get_dataset_example_output(span: HasSpanIO) -> dict[str, Any]:
|
|
|
56
45
|
present). For other span kinds, the output is extracted from the output
|
|
57
46
|
value and output mime type attributes.
|
|
58
47
|
"""
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
span_kind = span.span_kind
|
|
49
|
+
attributes = span.attributes
|
|
50
|
+
output_value = get_attribute_value(attributes, OUTPUT_VALUE)
|
|
51
|
+
output_mime_type = get_attribute_value(attributes, OUTPUT_MIME_TYPE)
|
|
52
|
+
output_messages = get_attribute_value(attributes, LLM_OUTPUT_MESSAGES)
|
|
53
|
+
retrieval_documents = get_attribute_value(attributes, RETRIEVAL_DOCUMENTS)
|
|
54
|
+
if span_kind == LLM:
|
|
63
55
|
return _get_llm_span_output(
|
|
64
|
-
output_messages=
|
|
56
|
+
output_messages=output_messages,
|
|
65
57
|
output_value=output_value,
|
|
66
58
|
output_mime_type=output_mime_type,
|
|
67
59
|
)
|
|
68
60
|
if span_kind == OpenInferenceSpanKindValues.RETRIEVER.value:
|
|
69
61
|
return _get_retriever_span_output(
|
|
70
|
-
retrieval_documents=
|
|
62
|
+
retrieval_documents=retrieval_documents,
|
|
71
63
|
output_value=output_value,
|
|
72
64
|
output_mime_type=output_mime_type,
|
|
73
65
|
)
|
|
@@ -90,8 +82,8 @@ def _get_llm_span_input(
|
|
|
90
82
|
input["messages"] = messages
|
|
91
83
|
if not input:
|
|
92
84
|
input = _get_generic_io_value(io_value=input_value, mime_type=input_mime_type, kind="input")
|
|
93
|
-
if prompt_template_variables:
|
|
94
|
-
input
|
|
85
|
+
if prompt_template_variables_data := _safely_json_decode(prompt_template_variables):
|
|
86
|
+
input["prompt_template_variables"] = prompt_template_variables_data
|
|
95
87
|
return input
|
|
96
88
|
|
|
97
89
|
|
|
@@ -118,7 +110,7 @@ def _get_retriever_span_output(
|
|
|
118
110
|
Extracts the output value from a retriever span and returns it as a dictionary.
|
|
119
111
|
The output is extracted from the retrieval documents (if present).
|
|
120
112
|
"""
|
|
121
|
-
if retrieval_documents is not None:
|
|
113
|
+
if (retrieval_documents := _parse_retrieval_documents(retrieval_documents)) is not None:
|
|
122
114
|
return {"documents": retrieval_documents}
|
|
123
115
|
return _get_generic_io_value(io_value=output_value, mime_type=output_mime_type, kind="output")
|
|
124
116
|
|
|
@@ -130,12 +122,14 @@ def _get_generic_io_value(
|
|
|
130
122
|
Makes a best-effort attempt to extract the input or output value from a span
|
|
131
123
|
and returns it as a dictionary.
|
|
132
124
|
"""
|
|
133
|
-
if
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
125
|
+
if (
|
|
126
|
+
mime_type == OpenInferenceMimeTypeValues.JSON.value
|
|
127
|
+
and (io_value_data := _safely_json_decode(io_value)) is not None
|
|
128
|
+
):
|
|
129
|
+
if isinstance(io_value_data, dict):
|
|
130
|
+
return io_value_data
|
|
137
131
|
else:
|
|
138
|
-
return {kind:
|
|
132
|
+
return {kind: io_value_data}
|
|
139
133
|
if isinstance(io_value, str):
|
|
140
134
|
return {kind: io_value}
|
|
141
135
|
return {}
|
|
@@ -169,6 +163,35 @@ def _get_message(message: Mapping[str, Any]) -> dict[str, Any]:
|
|
|
169
163
|
}
|
|
170
164
|
|
|
171
165
|
|
|
166
|
+
def _parse_retrieval_documents(retrieval_documents: Any) -> Optional[list[dict[str, Any]]]:
|
|
167
|
+
"""
|
|
168
|
+
Safely un-nests a list of retrieval documents.
|
|
169
|
+
|
|
170
|
+
Example: [{"document": {"content": "..."}}] -> [{"content": "..."}]
|
|
171
|
+
"""
|
|
172
|
+
if not isinstance(retrieval_documents, list):
|
|
173
|
+
return None
|
|
174
|
+
docs = []
|
|
175
|
+
for retrieval_doc in retrieval_documents:
|
|
176
|
+
if not isinstance(retrieval_doc, dict) or not (doc := retrieval_doc.get("document")):
|
|
177
|
+
return None
|
|
178
|
+
docs.append(doc)
|
|
179
|
+
return docs
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def _safely_json_decode(value: Any) -> Any:
|
|
183
|
+
"""
|
|
184
|
+
Safely decodes a JSON-encoded value.
|
|
185
|
+
"""
|
|
186
|
+
if not isinstance(value, str):
|
|
187
|
+
return None
|
|
188
|
+
try:
|
|
189
|
+
return json.loads(value)
|
|
190
|
+
except json.JSONDecodeError:
|
|
191
|
+
return None
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# MessageAttributes
|
|
172
195
|
MESSAGE_CONTENT = MessageAttributes.MESSAGE_CONTENT
|
|
173
196
|
MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON = MessageAttributes.MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON
|
|
174
197
|
MESSAGE_FUNCTION_CALL_NAME = MessageAttributes.MESSAGE_FUNCTION_CALL_NAME
|
|
@@ -176,5 +199,19 @@ MESSAGE_NAME = MessageAttributes.MESSAGE_NAME
|
|
|
176
199
|
MESSAGE_ROLE = MessageAttributes.MESSAGE_ROLE
|
|
177
200
|
MESSAGE_TOOL_CALLS = MessageAttributes.MESSAGE_TOOL_CALLS
|
|
178
201
|
|
|
179
|
-
|
|
202
|
+
# OpenInferenceSpanKindValues
|
|
203
|
+
LLM = OpenInferenceSpanKindValues.LLM.value
|
|
204
|
+
|
|
205
|
+
# SpanAttributes
|
|
206
|
+
INPUT_MIME_TYPE = SpanAttributes.INPUT_MIME_TYPE
|
|
207
|
+
INPUT_VALUE = SpanAttributes.INPUT_VALUE
|
|
208
|
+
LLM_INPUT_MESSAGES = SpanAttributes.LLM_INPUT_MESSAGES
|
|
209
|
+
LLM_OUTPUT_MESSAGES = SpanAttributes.LLM_OUTPUT_MESSAGES
|
|
210
|
+
LLM_PROMPT_TEMPLATE_VARIABLES = SpanAttributes.LLM_PROMPT_TEMPLATE_VARIABLES
|
|
211
|
+
OUTPUT_MIME_TYPE = SpanAttributes.OUTPUT_MIME_TYPE
|
|
212
|
+
OUTPUT_VALUE = SpanAttributes.OUTPUT_VALUE
|
|
213
|
+
RETRIEVAL_DOCUMENTS = SpanAttributes.RETRIEVAL_DOCUMENTS
|
|
214
|
+
|
|
215
|
+
# ToolCallAttributes
|
|
180
216
|
TOOL_CALL_FUNCTION_ARGUMENTS_JSON = ToolCallAttributes.TOOL_CALL_FUNCTION_ARGUMENTS_JSON
|
|
217
|
+
TOOL_CALL_FUNCTION_NAME = ToolCallAttributes.TOOL_CALL_FUNCTION_NAME
|
|
@@ -131,8 +131,8 @@ class PlaygroundRateLimiter(RateLimiter, KeyedSingleton):
|
|
|
131
131
|
await self._throttler.async_wait_until_ready()
|
|
132
132
|
request_start_time = time.time()
|
|
133
133
|
maybe_coroutine = fn(*args, **kwargs)
|
|
134
|
-
if inspect.
|
|
135
|
-
return await maybe_coroutine # type: ignore
|
|
134
|
+
if inspect.isawaitable(maybe_coroutine):
|
|
135
|
+
return await maybe_coroutine # type: ignore[no-any-return]
|
|
136
136
|
else:
|
|
137
137
|
return maybe_coroutine
|
|
138
138
|
except self._rate_limit_error:
|
|
@@ -144,10 +144,11 @@ class PlaygroundRateLimiter(RateLimiter, KeyedSingleton):
|
|
|
144
144
|
try:
|
|
145
145
|
request_start_time = time.time()
|
|
146
146
|
await self._throttler.async_wait_until_ready()
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
maybe_coroutine = fn(*args, **kwargs)
|
|
148
|
+
if inspect.isawaitable(maybe_coroutine):
|
|
149
|
+
return await maybe_coroutine # type: ignore[no-any-return]
|
|
149
150
|
else:
|
|
150
|
-
return
|
|
151
|
+
return maybe_coroutine
|
|
151
152
|
except self._rate_limit_error:
|
|
152
153
|
self._throttler.on_rate_limit_error(
|
|
153
154
|
request_start_time, verbose=self._verbose
|
|
@@ -283,7 +284,7 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
283
284
|
invocation_name="temperature",
|
|
284
285
|
canonical_name=CanonicalParameterName.TEMPERATURE,
|
|
285
286
|
label="Temperature",
|
|
286
|
-
default_value=
|
|
287
|
+
default_value=1.0,
|
|
287
288
|
min_value=0.0,
|
|
288
289
|
max_value=2.0,
|
|
289
290
|
),
|
|
@@ -295,12 +296,14 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
295
296
|
BoundedFloatInvocationParameter(
|
|
296
297
|
invocation_name="frequency_penalty",
|
|
297
298
|
label="Frequency Penalty",
|
|
299
|
+
default_value=0.0,
|
|
298
300
|
min_value=-2.0,
|
|
299
301
|
max_value=2.0,
|
|
300
302
|
),
|
|
301
303
|
BoundedFloatInvocationParameter(
|
|
302
304
|
invocation_name="presence_penalty",
|
|
303
305
|
label="Presence Penalty",
|
|
306
|
+
default_value=0.0,
|
|
304
307
|
min_value=-2.0,
|
|
305
308
|
max_value=2.0,
|
|
306
309
|
),
|
|
@@ -313,6 +316,7 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
313
316
|
invocation_name="top_p",
|
|
314
317
|
canonical_name=CanonicalParameterName.TOP_P,
|
|
315
318
|
label="Top P",
|
|
319
|
+
default_value=1.0,
|
|
316
320
|
min_value=0.0,
|
|
317
321
|
max_value=1.0,
|
|
318
322
|
),
|
|
@@ -345,7 +349,11 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
345
349
|
from openai.types.chat import ChatCompletionStreamOptionsParam
|
|
346
350
|
|
|
347
351
|
# Convert standard messages to OpenAI messages
|
|
348
|
-
openai_messages = [
|
|
352
|
+
openai_messages = []
|
|
353
|
+
for message in messages:
|
|
354
|
+
openai_message = self.to_openai_chat_completion_param(*message)
|
|
355
|
+
if openai_message is not None:
|
|
356
|
+
openai_messages.append(openai_message)
|
|
349
357
|
tool_call_ids: dict[int, str] = {}
|
|
350
358
|
token_usage: Optional["CompletionUsage"] = None
|
|
351
359
|
throttled_create = self.rate_limiter._alimit(self.client.chat.completions.create)
|
|
@@ -395,7 +403,7 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
395
403
|
content: JSONScalarType,
|
|
396
404
|
tool_call_id: Optional[str] = None,
|
|
397
405
|
tool_calls: Optional[list[JSONScalarType]] = None,
|
|
398
|
-
) -> "ChatCompletionMessageParam":
|
|
406
|
+
) -> Optional["ChatCompletionMessageParam"]:
|
|
399
407
|
from openai.types.chat import (
|
|
400
408
|
ChatCompletionAssistantMessageParam,
|
|
401
409
|
ChatCompletionSystemMessageParam,
|
|
@@ -495,65 +503,7 @@ class OpenAIO1StreamingClient(OpenAIStreamingClient):
|
|
|
495
503
|
),
|
|
496
504
|
]
|
|
497
505
|
|
|
498
|
-
|
|
499
|
-
self,
|
|
500
|
-
messages: list[
|
|
501
|
-
tuple[ChatCompletionMessageRole, str, Optional[str], Optional[list[JSONScalarType]]]
|
|
502
|
-
],
|
|
503
|
-
tools: list[JSONScalarType],
|
|
504
|
-
**invocation_parameters: Any,
|
|
505
|
-
) -> AsyncIterator[ChatCompletionChunk]:
|
|
506
|
-
from openai import NOT_GIVEN
|
|
507
|
-
|
|
508
|
-
# Convert standard messages to OpenAI messages
|
|
509
|
-
unfiltered_openai_messages = [
|
|
510
|
-
self.to_openai_o1_chat_completion_param(*message) for message in messages
|
|
511
|
-
]
|
|
512
|
-
|
|
513
|
-
# filter out unsupported messages
|
|
514
|
-
openai_messages: list[ChatCompletionMessageParam] = [
|
|
515
|
-
message for message in unfiltered_openai_messages if message is not None
|
|
516
|
-
]
|
|
517
|
-
|
|
518
|
-
tool_call_ids: dict[int, str] = {}
|
|
519
|
-
|
|
520
|
-
throttled_create = self.rate_limiter._alimit(self.client.chat.completions.create)
|
|
521
|
-
response = await throttled_create(
|
|
522
|
-
messages=openai_messages,
|
|
523
|
-
model=self.model_name,
|
|
524
|
-
tools=tools or NOT_GIVEN,
|
|
525
|
-
**invocation_parameters,
|
|
526
|
-
)
|
|
527
|
-
|
|
528
|
-
choice = response.choices[0]
|
|
529
|
-
message = choice.message
|
|
530
|
-
content = message.content
|
|
531
|
-
|
|
532
|
-
text_chunk = TextChunk(content=content)
|
|
533
|
-
yield text_chunk
|
|
534
|
-
|
|
535
|
-
if (tool_calls := message.tool_calls) is not None:
|
|
536
|
-
for tool_call_index, tool_call in enumerate(tool_calls):
|
|
537
|
-
tool_call_id = (
|
|
538
|
-
tool_call.id
|
|
539
|
-
if tool_call.id is not None
|
|
540
|
-
else tool_call_ids.get(tool_call_index, f"tool_call_{tool_call_index}")
|
|
541
|
-
)
|
|
542
|
-
tool_call_ids[tool_call_index] = tool_call_id
|
|
543
|
-
if (function := tool_call.function) is not None:
|
|
544
|
-
tool_call_chunk = ToolCallChunk(
|
|
545
|
-
id=tool_call_id,
|
|
546
|
-
function=FunctionCallChunk(
|
|
547
|
-
name=function.name or "",
|
|
548
|
-
arguments=function.arguments or "",
|
|
549
|
-
),
|
|
550
|
-
)
|
|
551
|
-
yield tool_call_chunk
|
|
552
|
-
|
|
553
|
-
if (usage := response.usage) is not None:
|
|
554
|
-
self._attributes.update(dict(self._llm_token_counts(usage)))
|
|
555
|
-
|
|
556
|
-
def to_openai_o1_chat_completion_param(
|
|
506
|
+
def to_openai_chat_completion_param(
|
|
557
507
|
self,
|
|
558
508
|
role: ChatCompletionMessageRole,
|
|
559
509
|
content: JSONScalarType,
|
|
@@ -625,6 +575,8 @@ class AzureOpenAIStreamingClient(OpenAIStreamingClient):
|
|
|
625
575
|
super().__init__(model=model, api_key=api_key)
|
|
626
576
|
self._attributes[LLM_PROVIDER] = OpenInferenceLLMProviderValues.AZURE.value
|
|
627
577
|
self._attributes[LLM_SYSTEM] = OpenInferenceLLMSystemValues.OPENAI.value
|
|
578
|
+
if not (api_key := api_key or os.environ.get("AZURE_OPENAI_API_KEY")):
|
|
579
|
+
raise BadRequest("An Azure API key is required for Azure OpenAI models")
|
|
628
580
|
if not (endpoint := model.endpoint or os.environ.get("AZURE_OPENAI_ENDPOINT")):
|
|
629
581
|
raise BadRequest("An Azure endpoint is required for Azure OpenAI models")
|
|
630
582
|
if not (api_version := model.api_version or os.environ.get("OPENAI_API_VERSION")):
|
|
@@ -640,8 +592,12 @@ class AzureOpenAIStreamingClient(OpenAIStreamingClient):
|
|
|
640
592
|
provider_key=GenerativeProviderKey.ANTHROPIC,
|
|
641
593
|
model_names=[
|
|
642
594
|
PROVIDER_DEFAULT,
|
|
595
|
+
"claude-3-5-sonnet-latest",
|
|
596
|
+
"claude-3-5-haiku-latest",
|
|
597
|
+
"claude-3-5-sonnet-20241022",
|
|
598
|
+
"claude-3-5-haiku-20241022",
|
|
643
599
|
"claude-3-5-sonnet-20240620",
|
|
644
|
-
"claude-3-opus-
|
|
600
|
+
"claude-3-opus-latest",
|
|
645
601
|
"claude-3-sonnet-20240229",
|
|
646
602
|
"claude-3-haiku-20240307",
|
|
647
603
|
],
|
|
@@ -674,12 +630,14 @@ class AnthropicStreamingClient(PlaygroundStreamingClient):
|
|
|
674
630
|
invocation_name="max_tokens",
|
|
675
631
|
canonical_name=CanonicalParameterName.MAX_COMPLETION_TOKENS,
|
|
676
632
|
label="Max Tokens",
|
|
633
|
+
default_value=1024,
|
|
677
634
|
required=True,
|
|
678
635
|
),
|
|
679
636
|
BoundedFloatInvocationParameter(
|
|
680
637
|
invocation_name="temperature",
|
|
681
638
|
canonical_name=CanonicalParameterName.TEMPERATURE,
|
|
682
639
|
label="Temperature",
|
|
640
|
+
default_value=1.0,
|
|
683
641
|
min_value=0.0,
|
|
684
642
|
max_value=1.0,
|
|
685
643
|
),
|
|
@@ -692,6 +650,7 @@ class AnthropicStreamingClient(PlaygroundStreamingClient):
|
|
|
692
650
|
invocation_name="top_p",
|
|
693
651
|
canonical_name=CanonicalParameterName.TOP_P,
|
|
694
652
|
label="Top P",
|
|
653
|
+
default_value=1.0,
|
|
695
654
|
min_value=0.0,
|
|
696
655
|
max_value=1.0,
|
|
697
656
|
),
|
|
@@ -850,7 +809,7 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
850
809
|
invocation_name="temperature",
|
|
851
810
|
canonical_name=CanonicalParameterName.TEMPERATURE,
|
|
852
811
|
label="Temperature",
|
|
853
|
-
default_value=
|
|
812
|
+
default_value=1.0,
|
|
854
813
|
min_value=0.0,
|
|
855
814
|
max_value=2.0,
|
|
856
815
|
),
|
|
@@ -860,35 +819,31 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
860
819
|
label="Max Output Tokens",
|
|
861
820
|
),
|
|
862
821
|
StringListInvocationParameter(
|
|
863
|
-
invocation_name="
|
|
822
|
+
invocation_name="stop_sequences",
|
|
864
823
|
canonical_name=CanonicalParameterName.STOP_SEQUENCES,
|
|
865
824
|
label="Stop Sequences",
|
|
866
825
|
),
|
|
867
826
|
FloatInvocationParameter(
|
|
868
827
|
invocation_name="presence_penalty",
|
|
869
828
|
label="Presence Penalty",
|
|
829
|
+
default_value=0.0,
|
|
870
830
|
),
|
|
871
831
|
FloatInvocationParameter(
|
|
872
832
|
invocation_name="frequency_penalty",
|
|
873
833
|
label="Frequency Penalty",
|
|
834
|
+
default_value=0.0,
|
|
874
835
|
),
|
|
875
836
|
BoundedFloatInvocationParameter(
|
|
876
837
|
invocation_name="top_p",
|
|
877
838
|
canonical_name=CanonicalParameterName.TOP_P,
|
|
878
839
|
label="Top P",
|
|
840
|
+
default_value=1.0,
|
|
879
841
|
min_value=0.0,
|
|
880
842
|
max_value=1.0,
|
|
881
843
|
),
|
|
882
|
-
|
|
844
|
+
IntInvocationParameter(
|
|
883
845
|
invocation_name="top_k",
|
|
884
846
|
label="Top K",
|
|
885
|
-
min_value=0.0,
|
|
886
|
-
max_value=1.0,
|
|
887
|
-
),
|
|
888
|
-
IntInvocationParameter(
|
|
889
|
-
invocation_name="seed",
|
|
890
|
-
canonical_name=CanonicalParameterName.RANDOM_SEED,
|
|
891
|
-
label="Seed",
|
|
892
847
|
),
|
|
893
848
|
]
|
|
894
849
|
|
|
@@ -923,6 +878,13 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
923
878
|
chat = client.start_chat(history=gemini_message_history)
|
|
924
879
|
stream = await chat.send_message_async(**gemini_params)
|
|
925
880
|
async for event in stream:
|
|
881
|
+
self._attributes.update(
|
|
882
|
+
{
|
|
883
|
+
LLM_TOKEN_COUNT_PROMPT: event.usage_metadata.prompt_token_count,
|
|
884
|
+
LLM_TOKEN_COUNT_COMPLETION: event.usage_metadata.candidates_token_count,
|
|
885
|
+
LLM_TOKEN_COUNT_TOTAL: event.usage_metadata.total_token_count,
|
|
886
|
+
}
|
|
887
|
+
)
|
|
926
888
|
yield TextChunk(content=event.text)
|
|
927
889
|
|
|
928
890
|
def _build_gemini_messages(
|
|
@@ -31,6 +31,7 @@ from typing_extensions import Self, TypeAlias, assert_never
|
|
|
31
31
|
|
|
32
32
|
from phoenix.datetime_utils import local_now, normalize_datetime
|
|
33
33
|
from phoenix.db import models
|
|
34
|
+
from phoenix.server.api.helpers.dataset_helpers import get_dataset_example_output
|
|
34
35
|
from phoenix.server.api.input_types.ChatCompletionInput import (
|
|
35
36
|
ChatCompletionInput,
|
|
36
37
|
ChatCompletionOverDatasetInput,
|
|
@@ -220,7 +221,7 @@ def get_db_experiment_run(
|
|
|
220
221
|
dataset_example_id=example_id,
|
|
221
222
|
trace_id=db_trace.trace_id,
|
|
222
223
|
output=models.ExperimentRunOutput(
|
|
223
|
-
task_output=
|
|
224
|
+
task_output=get_dataset_example_output(db_span),
|
|
224
225
|
),
|
|
225
226
|
repetition_number=1,
|
|
226
227
|
start_time=db_span.start_time,
|