arize-phoenix 5.12.0__py3-none-any.whl → 6.1.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.12.0.dist-info → arize_phoenix-6.1.0.dist-info}/METADATA +2 -2
- {arize_phoenix-5.12.0.dist-info → arize_phoenix-6.1.0.dist-info}/RECORD +23 -23
- phoenix/experiments/evaluators/llm_evaluators.py +2 -2
- phoenix/server/api/helpers/dataset_helpers.py +77 -40
- phoenix/server/api/helpers/playground_clients.py +7 -16
- phoenix/server/api/helpers/playground_spans.py +2 -1
- phoenix/server/api/mutations/chat_mutations.py +3 -2
- phoenix/server/api/mutations/dataset_mutations.py +10 -30
- phoenix/server/api/routers/v1/evaluations.py +1 -1
- phoenix/server/api/types/Span.py +12 -49
- phoenix/server/static/.vite/manifest.json +31 -31
- phoenix/server/static/assets/{components-72cQL1d1.js → components-CdiZ1Osh.js} +147 -141
- phoenix/server/static/assets/index-D_sCOjlG.js +101 -0
- phoenix/server/static/assets/{pages-DFAkBAUh.js → pages-FArMEfgg.js} +353 -344
- phoenix/server/static/assets/{vendor-DexmGnha.js → vendor-Bnv1dNRQ.js} +221 -195
- phoenix/server/static/assets/{vendor-arizeai--Q3ol330.js → vendor-arizeai-BG6iwyLC.js} +2 -2
- phoenix/server/static/assets/{vendor-codemirror-B4bYvWa6.js → vendor-codemirror-BotnVFFX.js} +1 -1
- phoenix/server/static/assets/{vendor-recharts-B4ZzJhNh.js → vendor-recharts-Dy5gEFzQ.js} +1 -1
- phoenix/version.py +1 -1
- phoenix/server/static/assets/index-BowjltW-.js +0 -101
- {arize_phoenix-5.12.0.dist-info → arize_phoenix-6.1.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-5.12.0.dist-info → arize_phoenix-6.1.0.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-5.12.0.dist-info → arize_phoenix-6.1.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-5.12.0.dist-info → arize_phoenix-6.1.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: arize-phoenix
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.1.0
|
|
4
4
|
Summary: AI Observability and Evaluation
|
|
5
5
|
Project-URL: Documentation, https://docs.arize.com/phoenix/
|
|
6
6
|
Project-URL: Issues, https://github.com/Arize-ai/phoenix/issues
|
|
@@ -196,8 +196,8 @@ Phoenix container images are available via [Docker Hub](https://hub.docker.com/r
|
|
|
196
196
|
| Projects | ✅ |
|
|
197
197
|
| [Self-Hosting](https://docs.arize.com/phoenix/deployment) | ✅ |
|
|
198
198
|
| Jupyter Notebooks | ✅ |
|
|
199
|
+
| [Prompt Playground](https://docs.arize.com/phoenix/prompt-engineering/overview-prompts) | ✅ |
|
|
199
200
|
| [Sessions](https://github.com/Arize-ai/phoenix/issues/2619) | In Progress 🚧 |
|
|
200
|
-
| [Prompt Playground](https://github.com/Arize-ai/phoenix/issues/3435) | In Progress 🚧 |
|
|
201
201
|
| Prompt Management | Coming soon ⏱️ |
|
|
202
202
|
|
|
203
203
|
## Tracing Integrations
|
|
@@ -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=PD5agZ0_DXqsFLMBR0hacZV3LbzGbH8qn-j7MIAm3Xs,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
|
|
@@ -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,7 +241,7 @@ 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
247
|
phoenix/server/api/types/TemplateLanguage.py,sha256=6j_0uwO_GZIeCpR7sTOnxySXudT7qBSC6LFsjzbvW1o,160
|
|
@@ -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-
|
|
276
|
+
phoenix/server/static/.vite/manifest.json,sha256=R621q8gnowayj2q8CpWgoj2oHbsTB8H_T7mU1UfiydI,1929
|
|
277
|
+
phoenix/server/static/assets/components-CdiZ1Osh.js,sha256=iG9VJFu5MxrXzhYpAwM1Q9OsKOkOxJcFJZujcT55JNo,314108
|
|
278
|
+
phoenix/server/static/assets/index-D_sCOjlG.js,sha256=5EarOgtXkqjy1ALckGtmpGJCiPo1xWdn-6ygjFoiqB8,8305
|
|
279
|
+
phoenix/server/static/assets/pages-FArMEfgg.js,sha256=9CY_Ri-LnqY6xk2V95TN0NlvgbTmm4kCWdtVfa6oLqw,631219
|
|
280
|
+
phoenix/server/static/assets/vendor-Bnv1dNRQ.js,sha256=sHBast25yiz3Tg7DMNCKx_KpPHkxi94PKJz_2-hD0_Y,10975957
|
|
281
281
|
phoenix/server/static/assets/vendor-DxkFTwjz.css,sha256=nZrkr0u6NNElFGvpWHk9GTHeGoibCXCli1bE7mXZGZg,1816
|
|
282
|
-
phoenix/server/static/assets/vendor-arizeai
|
|
283
|
-
phoenix/server/static/assets/vendor-codemirror-
|
|
284
|
-
phoenix/server/static/assets/vendor-recharts-
|
|
282
|
+
phoenix/server/static/assets/vendor-arizeai-BG6iwyLC.js,sha256=rHkAk1Q2wkNV_3MirT0MYdA-oyCKpu5bFhpsaISg9fs,308489
|
|
283
|
+
phoenix/server/static/assets/vendor-codemirror-BotnVFFX.js,sha256=yZnTXw9fvnqCrz53jYGv1pXM2QX-9W_ioLS9417Mijw,392709
|
|
284
|
+
phoenix/server/static/assets/vendor-recharts-Dy5gEFzQ.js,sha256=z5_pZ5IJNbdA7EjAYdIeGxd1L7HifEzKmxXvq7EVIBw,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
|
|
@@ -322,9 +322,9 @@ phoenix/utilities/project.py,sha256=auVpARXkDb-JgeX5f2aStyFIkeKvGwN9l7qrFeJMVxI,
|
|
|
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
324
|
phoenix/utilities/template_formatters.py,sha256=gh9PJD6WEGw7TEYXfSst1UR4pWWwmjxMLrDVQ_CkpkQ,2779
|
|
325
|
-
arize_phoenix-
|
|
326
|
-
arize_phoenix-
|
|
327
|
-
arize_phoenix-
|
|
328
|
-
arize_phoenix-
|
|
329
|
-
arize_phoenix-
|
|
330
|
-
arize_phoenix-
|
|
325
|
+
arize_phoenix-6.1.0.dist-info/METADATA,sha256=8ecHY7M9HSPtGBPqVfj5np5ZbUEJ2ijGIHVGiw_u_Ak,22669
|
|
326
|
+
arize_phoenix-6.1.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
327
|
+
arize_phoenix-6.1.0.dist-info/entry_points.txt,sha256=Pgpn8Upxx9P8z8joPXZWl2LlnAlGc3gcQoVchb06X1Q,94
|
|
328
|
+
arize_phoenix-6.1.0.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
|
|
329
|
+
arize_phoenix-6.1.0.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
|
|
330
|
+
arize_phoenix-6.1.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
|
|
@@ -284,7 +284,7 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
284
284
|
invocation_name="temperature",
|
|
285
285
|
canonical_name=CanonicalParameterName.TEMPERATURE,
|
|
286
286
|
label="Temperature",
|
|
287
|
-
default_value=
|
|
287
|
+
default_value=1.0,
|
|
288
288
|
min_value=0.0,
|
|
289
289
|
max_value=2.0,
|
|
290
290
|
),
|
|
@@ -323,7 +323,6 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
323
323
|
IntInvocationParameter(
|
|
324
324
|
invocation_name="seed",
|
|
325
325
|
canonical_name=CanonicalParameterName.RANDOM_SEED,
|
|
326
|
-
default_value=0,
|
|
327
326
|
label="Seed",
|
|
328
327
|
),
|
|
329
328
|
JSONInvocationParameter(
|
|
@@ -496,7 +495,6 @@ class OpenAIO1StreamingClient(OpenAIStreamingClient):
|
|
|
496
495
|
invocation_name="seed",
|
|
497
496
|
canonical_name=CanonicalParameterName.RANDOM_SEED,
|
|
498
497
|
label="Seed",
|
|
499
|
-
default_value=0,
|
|
500
498
|
),
|
|
501
499
|
JSONInvocationParameter(
|
|
502
500
|
invocation_name="tool_choice",
|
|
@@ -577,6 +575,8 @@ class AzureOpenAIStreamingClient(OpenAIStreamingClient):
|
|
|
577
575
|
super().__init__(model=model, api_key=api_key)
|
|
578
576
|
self._attributes[LLM_PROVIDER] = OpenInferenceLLMProviderValues.AZURE.value
|
|
579
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")
|
|
580
580
|
if not (endpoint := model.endpoint or os.environ.get("AZURE_OPENAI_ENDPOINT")):
|
|
581
581
|
raise BadRequest("An Azure endpoint is required for Azure OpenAI models")
|
|
582
582
|
if not (api_version := model.api_version or os.environ.get("OPENAI_API_VERSION")):
|
|
@@ -637,7 +637,7 @@ class AnthropicStreamingClient(PlaygroundStreamingClient):
|
|
|
637
637
|
invocation_name="temperature",
|
|
638
638
|
canonical_name=CanonicalParameterName.TEMPERATURE,
|
|
639
639
|
label="Temperature",
|
|
640
|
-
default_value=
|
|
640
|
+
default_value=1.0,
|
|
641
641
|
min_value=0.0,
|
|
642
642
|
max_value=1.0,
|
|
643
643
|
),
|
|
@@ -809,7 +809,7 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
809
809
|
invocation_name="temperature",
|
|
810
810
|
canonical_name=CanonicalParameterName.TEMPERATURE,
|
|
811
811
|
label="Temperature",
|
|
812
|
-
default_value=
|
|
812
|
+
default_value=1.0,
|
|
813
813
|
min_value=0.0,
|
|
814
814
|
max_value=2.0,
|
|
815
815
|
),
|
|
@@ -819,7 +819,7 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
819
819
|
label="Max Output Tokens",
|
|
820
820
|
),
|
|
821
821
|
StringListInvocationParameter(
|
|
822
|
-
invocation_name="
|
|
822
|
+
invocation_name="stop_sequences",
|
|
823
823
|
canonical_name=CanonicalParameterName.STOP_SEQUENCES,
|
|
824
824
|
label="Stop Sequences",
|
|
825
825
|
),
|
|
@@ -841,18 +841,9 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
841
841
|
min_value=0.0,
|
|
842
842
|
max_value=1.0,
|
|
843
843
|
),
|
|
844
|
-
|
|
844
|
+
IntInvocationParameter(
|
|
845
845
|
invocation_name="top_k",
|
|
846
846
|
label="Top K",
|
|
847
|
-
default_value=1.0,
|
|
848
|
-
min_value=0.0,
|
|
849
|
-
max_value=1.0,
|
|
850
|
-
),
|
|
851
|
-
IntInvocationParameter(
|
|
852
|
-
invocation_name="seed",
|
|
853
|
-
canonical_name=CanonicalParameterName.RANDOM_SEED,
|
|
854
|
-
label="Seed",
|
|
855
|
-
default_value=0,
|
|
856
847
|
),
|
|
857
848
|
]
|
|
858
849
|
|
|
@@ -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,
|
|
@@ -28,6 +28,7 @@ from phoenix.db.helpers import get_dataset_example_revisions
|
|
|
28
28
|
from phoenix.server.api.auth import IsNotReadOnly
|
|
29
29
|
from phoenix.server.api.context import Context
|
|
30
30
|
from phoenix.server.api.exceptions import BadRequest, CustomGraphQLError, NotFound
|
|
31
|
+
from phoenix.server.api.helpers.dataset_helpers import get_dataset_example_output
|
|
31
32
|
from phoenix.server.api.helpers.playground_clients import (
|
|
32
33
|
PlaygroundStreamingClient,
|
|
33
34
|
initialize_playground_clients,
|
|
@@ -62,7 +63,7 @@ from phoenix.server.api.types.node import from_global_id_with_expected_type
|
|
|
62
63
|
from phoenix.server.api.types.Span import Span, to_gql_span
|
|
63
64
|
from phoenix.server.api.types.TemplateLanguage import TemplateLanguage
|
|
64
65
|
from phoenix.server.dml_event import SpanInsertEvent
|
|
65
|
-
from phoenix.trace.attributes import
|
|
66
|
+
from phoenix.trace.attributes import unflatten
|
|
66
67
|
from phoenix.trace.schemas import SpanException
|
|
67
68
|
from phoenix.utilities.json import jsonify
|
|
68
69
|
from phoenix.utilities.template_formatters import (
|
|
@@ -244,7 +245,7 @@ class ChatCompletionMutationMixin:
|
|
|
244
245
|
dataset_example_id=revision.dataset_example_id,
|
|
245
246
|
trace_id=str(result.span.context.trace_id),
|
|
246
247
|
output=models.ExperimentRunOutput(
|
|
247
|
-
task_output=
|
|
248
|
+
task_output=get_dataset_example_output(db_span),
|
|
248
249
|
),
|
|
249
250
|
prompt_token_count=db_span.cumulative_llm_token_count_prompt,
|
|
250
251
|
completion_token_count=db_span.cumulative_llm_token_count_completion,
|
|
@@ -136,23 +136,7 @@ class DatasetMutationMixin:
|
|
|
136
136
|
.returning(models.DatasetVersion.id)
|
|
137
137
|
)
|
|
138
138
|
spans = (
|
|
139
|
-
await session.
|
|
140
|
-
select(
|
|
141
|
-
models.Span.id,
|
|
142
|
-
models.Span.span_kind,
|
|
143
|
-
models.Span.attributes,
|
|
144
|
-
_span_attribute(INPUT_MIME_TYPE),
|
|
145
|
-
_span_attribute(INPUT_VALUE),
|
|
146
|
-
_span_attribute(OUTPUT_MIME_TYPE),
|
|
147
|
-
_span_attribute(OUTPUT_VALUE),
|
|
148
|
-
_span_attribute(LLM_PROMPT_TEMPLATE_VARIABLES),
|
|
149
|
-
_span_attribute(LLM_INPUT_MESSAGES),
|
|
150
|
-
_span_attribute(LLM_OUTPUT_MESSAGES),
|
|
151
|
-
_span_attribute(RETRIEVAL_DOCUMENTS),
|
|
152
|
-
)
|
|
153
|
-
.select_from(models.Span)
|
|
154
|
-
.where(models.Span.id.in_(span_rowids))
|
|
155
|
-
)
|
|
139
|
+
await session.scalars(select(models.Span).where(models.Span.id.in_(span_rowids)))
|
|
156
140
|
).all()
|
|
157
141
|
if missing_span_rowids := span_rowids - {span.id for span in spans}:
|
|
158
142
|
raise ValueError(
|
|
@@ -160,18 +144,10 @@ class DatasetMutationMixin:
|
|
|
160
144
|
) # todo: implement error handling types https://github.com/Arize-ai/phoenix/issues/3221
|
|
161
145
|
|
|
162
146
|
span_annotations = (
|
|
163
|
-
await session.
|
|
164
|
-
select(
|
|
165
|
-
models.SpanAnnotation.span_rowid
|
|
166
|
-
models.SpanAnnotation.name,
|
|
167
|
-
models.SpanAnnotation.label,
|
|
168
|
-
models.SpanAnnotation.score,
|
|
169
|
-
models.SpanAnnotation.explanation,
|
|
170
|
-
models.SpanAnnotation.metadata_,
|
|
171
|
-
models.SpanAnnotation.annotator_kind,
|
|
147
|
+
await session.scalars(
|
|
148
|
+
select(models.SpanAnnotation).where(
|
|
149
|
+
models.SpanAnnotation.span_rowid.in_(span_rowids)
|
|
172
150
|
)
|
|
173
|
-
.select_from(models.SpanAnnotation)
|
|
174
|
-
.where(models.SpanAnnotation.span_rowid.in_(span_rowids))
|
|
175
151
|
)
|
|
176
152
|
).all()
|
|
177
153
|
|
|
@@ -214,8 +190,12 @@ class DatasetMutationMixin:
|
|
|
214
190
|
DatasetExampleRevision.input.key: get_dataset_example_input(span),
|
|
215
191
|
DatasetExampleRevision.output.key: get_dataset_example_output(span),
|
|
216
192
|
DatasetExampleRevision.metadata_.key: {
|
|
217
|
-
|
|
218
|
-
|
|
193
|
+
"span_kind": span.span_kind,
|
|
194
|
+
**(
|
|
195
|
+
{"annotations": annotations}
|
|
196
|
+
if (annotations := span_annotations_by_span[span.id])
|
|
197
|
+
else {}
|
|
198
|
+
),
|
|
219
199
|
},
|
|
220
200
|
DatasetExampleRevision.revision_kind.key: "CREATE",
|
|
221
201
|
}
|
phoenix/server/api/types/Span.py
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from collections.abc import Mapping, Sized
|
|
3
|
-
from dataclasses import dataclass
|
|
4
3
|
from datetime import datetime
|
|
5
4
|
from enum import Enum
|
|
6
5
|
from typing import TYPE_CHECKING, Any, Optional, cast
|
|
7
6
|
|
|
8
7
|
import numpy as np
|
|
9
8
|
import strawberry
|
|
10
|
-
from openinference.semconv.trace import
|
|
9
|
+
from openinference.semconv.trace import SpanAttributes
|
|
11
10
|
from strawberry import ID, UNSET
|
|
12
11
|
from strawberry.relay import Node, NodeID
|
|
13
12
|
from strawberry.types import Info
|
|
@@ -39,18 +38,6 @@ from .SpanAnnotation import SpanAnnotation
|
|
|
39
38
|
if TYPE_CHECKING:
|
|
40
39
|
from phoenix.server.api.types.Project import Project
|
|
41
40
|
|
|
42
|
-
EMBEDDING_EMBEDDINGS = SpanAttributes.EMBEDDING_EMBEDDINGS
|
|
43
|
-
EMBEDDING_VECTOR = EmbeddingAttributes.EMBEDDING_VECTOR
|
|
44
|
-
INPUT_MIME_TYPE = SpanAttributes.INPUT_MIME_TYPE
|
|
45
|
-
INPUT_VALUE = SpanAttributes.INPUT_VALUE
|
|
46
|
-
LLM_PROMPT_TEMPLATE_VARIABLES = SpanAttributes.LLM_PROMPT_TEMPLATE_VARIABLES
|
|
47
|
-
LLM_INPUT_MESSAGES = SpanAttributes.LLM_INPUT_MESSAGES
|
|
48
|
-
LLM_OUTPUT_MESSAGES = SpanAttributes.LLM_OUTPUT_MESSAGES
|
|
49
|
-
METADATA = SpanAttributes.METADATA
|
|
50
|
-
OUTPUT_MIME_TYPE = SpanAttributes.OUTPUT_MIME_TYPE
|
|
51
|
-
OUTPUT_VALUE = SpanAttributes.OUTPUT_VALUE
|
|
52
|
-
RETRIEVAL_DOCUMENTS = SpanAttributes.RETRIEVAL_DOCUMENTS
|
|
53
|
-
|
|
54
41
|
|
|
55
42
|
@strawberry.enum
|
|
56
43
|
class SpanKind(Enum):
|
|
@@ -236,21 +223,7 @@ class Span(Node):
|
|
|
236
223
|
description="The span's attributes translated into an example revision for a dataset",
|
|
237
224
|
) # type: ignore
|
|
238
225
|
async def as_example_revision(self, info: Info[Context, None]) -> SpanAsExampleRevision:
|
|
239
|
-
|
|
240
|
-
attributes = db_span.attributes
|
|
241
|
-
span_io = _SpanIO(
|
|
242
|
-
span_kind=db_span.span_kind,
|
|
243
|
-
input_value=get_attribute_value(attributes, INPUT_VALUE),
|
|
244
|
-
input_mime_type=get_attribute_value(attributes, INPUT_MIME_TYPE),
|
|
245
|
-
output_value=get_attribute_value(attributes, OUTPUT_VALUE),
|
|
246
|
-
output_mime_type=get_attribute_value(attributes, OUTPUT_MIME_TYPE),
|
|
247
|
-
llm_prompt_template_variables=get_attribute_value(
|
|
248
|
-
attributes, LLM_PROMPT_TEMPLATE_VARIABLES
|
|
249
|
-
),
|
|
250
|
-
llm_input_messages=get_attribute_value(attributes, LLM_INPUT_MESSAGES),
|
|
251
|
-
llm_output_messages=get_attribute_value(attributes, LLM_OUTPUT_MESSAGES),
|
|
252
|
-
retrieval_documents=get_attribute_value(attributes, RETRIEVAL_DOCUMENTS),
|
|
253
|
-
)
|
|
226
|
+
span = self.db_span
|
|
254
227
|
|
|
255
228
|
# Fetch annotations associated with this span
|
|
256
229
|
span_annotations = await self.span_annotations(info)
|
|
@@ -265,13 +238,13 @@ class Span(Node):
|
|
|
265
238
|
}
|
|
266
239
|
# Merge annotations into the metadata
|
|
267
240
|
metadata = {
|
|
268
|
-
|
|
269
|
-
"annotations": annotations,
|
|
241
|
+
"span_kind": span.span_kind,
|
|
242
|
+
**({"annotations": annotations} if annotations else {}),
|
|
270
243
|
}
|
|
271
244
|
|
|
272
245
|
return SpanAsExampleRevision(
|
|
273
|
-
input=get_dataset_example_input(
|
|
274
|
-
output=get_dataset_example_output(
|
|
246
|
+
input=get_dataset_example_input(span),
|
|
247
|
+
output=get_dataset_example_output(span),
|
|
275
248
|
metadata=metadata,
|
|
276
249
|
)
|
|
277
250
|
|
|
@@ -435,19 +408,9 @@ def _convert_metadata_to_string(metadata: Any) -> Optional[str]:
|
|
|
435
408
|
return str(metadata)
|
|
436
409
|
|
|
437
410
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
span_kind: Optional[str]
|
|
446
|
-
input_value: Any
|
|
447
|
-
input_mime_type: Optional[str]
|
|
448
|
-
output_value: Any
|
|
449
|
-
output_mime_type: Optional[str]
|
|
450
|
-
llm_prompt_template_variables: Any
|
|
451
|
-
llm_input_messages: Any
|
|
452
|
-
llm_output_messages: Any
|
|
453
|
-
retrieval_documents: Any
|
|
411
|
+
INPUT_MIME_TYPE = SpanAttributes.INPUT_MIME_TYPE
|
|
412
|
+
INPUT_VALUE = SpanAttributes.INPUT_VALUE
|
|
413
|
+
METADATA = SpanAttributes.METADATA
|
|
414
|
+
OUTPUT_MIME_TYPE = SpanAttributes.OUTPUT_MIME_TYPE
|
|
415
|
+
OUTPUT_VALUE = SpanAttributes.OUTPUT_VALUE
|
|
416
|
+
RETRIEVAL_DOCUMENTS = SpanAttributes.RETRIEVAL_DOCUMENTS
|