arize-phoenix 5.11.0__py3-none-any.whl → 5.12.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-5.12.0.dist-info}/METADATA +1 -1
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-5.12.0.dist-info}/RECORD +20 -20
- phoenix/server/api/helpers/playground_clients.py +38 -67
- phoenix/server/api/mutations/chat_mutations.py +6 -2
- phoenix/server/api/subscriptions.py +52 -13
- 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-72cQL1d1.js} +48 -48
- phoenix/server/static/assets/{index-D7UiCRtr.js → index-BowjltW-.js} +2 -2
- phoenix/server/static/assets/{pages-DYHcAdjT.js → pages-DFAkBAUh.js} +296 -277
- phoenix/server/static/assets/{vendor-BCxsh5i3.js → vendor-DexmGnha.js} +1 -1
- phoenix/server/static/assets/{vendor-arizeai-C2CDZgMz.js → vendor-arizeai--Q3ol330.js} +8 -8
- phoenix/server/static/assets/{vendor-codemirror-DYbtnCTn.js → vendor-codemirror-B4bYvWa6.js} +1 -1
- phoenix/server/static/assets/{vendor-recharts-P6W8G0Mb.js → vendor-recharts-B4ZzJhNh.js} +1 -1
- phoenix/utilities/template_formatters.py +18 -0
- phoenix/version.py +1 -1
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-5.12.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-5.12.0.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-5.12.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-5.11.0.dist-info → arize_phoenix-5.12.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=9dFDHPiqLy0dTf00acCCS0XDudNj7hSnMr9G2iMDI6A,23
|
|
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
|
|
@@ -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
|
|
@@ -125,7 +125,7 @@ phoenix/server/api/dataloaders/cache/__init__.py,sha256=SYoOM9n8FJaMdQarma5d1blu
|
|
|
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
127
|
phoenix/server/api/helpers/dataset_helpers.py,sha256=14mldZp9to3rr9BdvvoFqEwZHHV_k2e7jPm8q9z2OdQ,6896
|
|
128
|
-
phoenix/server/api/helpers/playground_clients.py,sha256=
|
|
128
|
+
phoenix/server/api/helpers/playground_clients.py,sha256=hIxAM09HexNyKk0HQYbAD-X5axyw7my7B0dhPFzwueo,36383
|
|
129
129
|
phoenix/server/api/helpers/playground_registry.py,sha256=CPLMziFB2wmr-dfbx7VbzO2f8YIG_k5RftzvGXYGQ1w,2570
|
|
130
130
|
phoenix/server/api/helpers/playground_spans.py,sha256=LJjndkVxr6DsfVFerrtMZWlRd5YL5AIbcM2CvFe8ajc,16489
|
|
131
131
|
phoenix/server/api/input_types/AddExamplesToDatasetInput.py,sha256=mIQz0S_z8YdrktKIY6RCvtNJ2yZF9pYvTGgasUsI-54,430
|
|
@@ -164,7 +164,7 @@ 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=
|
|
167
|
+
phoenix/server/api/mutations/chat_mutations.py,sha256=Nz7pz6cTvxub33kW6J0KgYmf7Lhb1ZmzF65KeUqYjiQ,22795
|
|
168
168
|
phoenix/server/api/mutations/dataset_mutations.py,sha256=siwsSmozKRIK8ZhPrfWl-GxKCL4lAmRPms862tG2KXY,27064
|
|
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
|
|
@@ -244,7 +244,7 @@ phoenix/server/api/types/SortDir.py,sha256=OUpXhlCzCxPoXSDkJJygEs9Rw9pMymfaZUG5z
|
|
|
244
244
|
phoenix/server/api/types/Span.py,sha256=6GS6MpJ3f8P2LrQUe2TWPrPf7ENxmde_wisQkJguphw,16919
|
|
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-
|
|
276
|
+
phoenix/server/static/.vite/manifest.json,sha256=MbaJGZ9fqq-pJiyZWU0xbb2FXhmggvZc6DNnIWBeJow,1929
|
|
277
|
+
phoenix/server/static/assets/components-72cQL1d1.js,sha256=wSbuZXCJY152KhyfYItsBNWOU8LqshboNmVlCof-r70,306866
|
|
278
|
+
phoenix/server/static/assets/index-BowjltW-.js,sha256=Zgvw87yavo4A9jEyPQAzFKNBiAFF_SWzZopNsbfwMig,7290
|
|
279
|
+
phoenix/server/static/assets/pages-DFAkBAUh.js,sha256=SMq23Vg-OZSvgSdKOkogJBhNXzlRfyl_oZYKJPyNqvY,636153
|
|
280
|
+
phoenix/server/static/assets/vendor-DexmGnha.js,sha256=sieuT9Y_X4RXRfqPAXRBpPPPwdb3KCfkEXwCfKwyJFc,10899238
|
|
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--Q3ol330.js,sha256=DmwyVdLagWoGvOKRRAlwDibT1Qk4-IPmTDaLlXFjRFQ,308483
|
|
283
|
+
phoenix/server/static/assets/vendor-codemirror-B4bYvWa6.js,sha256=u5U1cT5PopN6AbYt4S55bI9X0REQ35Pa9BXZmb5Piww,392709
|
|
284
|
+
phoenix/server/static/assets/vendor-recharts-B4ZzJhNh.js,sha256=gS2dHFlC9A4tMk1tmNhtQo04SDcD2gQSkS4N6QS7d_0,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-5.
|
|
326
|
-
arize_phoenix-5.
|
|
327
|
-
arize_phoenix-5.
|
|
328
|
-
arize_phoenix-5.
|
|
329
|
-
arize_phoenix-5.
|
|
330
|
-
arize_phoenix-5.
|
|
324
|
+
phoenix/utilities/template_formatters.py,sha256=gh9PJD6WEGw7TEYXfSst1UR4pWWwmjxMLrDVQ_CkpkQ,2779
|
|
325
|
+
arize_phoenix-5.12.0.dist-info/METADATA,sha256=DTW4JHWstCwzlLmXkne9Ls3JG9uGXXpGjSNqqz2BfqI,22671
|
|
326
|
+
arize_phoenix-5.12.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
327
|
+
arize_phoenix-5.12.0.dist-info/entry_points.txt,sha256=Pgpn8Upxx9P8z8joPXZWl2LlnAlGc3gcQoVchb06X1Q,94
|
|
328
|
+
arize_phoenix-5.12.0.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
|
|
329
|
+
arize_phoenix-5.12.0.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
|
|
330
|
+
arize_phoenix-5.12.0.dist-info/RECORD,,
|
|
@@ -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
|
|
@@ -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,12 +316,14 @@ 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
|
),
|
|
319
323
|
IntInvocationParameter(
|
|
320
324
|
invocation_name="seed",
|
|
321
325
|
canonical_name=CanonicalParameterName.RANDOM_SEED,
|
|
326
|
+
default_value=0,
|
|
322
327
|
label="Seed",
|
|
323
328
|
),
|
|
324
329
|
JSONInvocationParameter(
|
|
@@ -345,7 +350,11 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
345
350
|
from openai.types.chat import ChatCompletionStreamOptionsParam
|
|
346
351
|
|
|
347
352
|
# Convert standard messages to OpenAI messages
|
|
348
|
-
openai_messages = [
|
|
353
|
+
openai_messages = []
|
|
354
|
+
for message in messages:
|
|
355
|
+
openai_message = self.to_openai_chat_completion_param(*message)
|
|
356
|
+
if openai_message is not None:
|
|
357
|
+
openai_messages.append(openai_message)
|
|
349
358
|
tool_call_ids: dict[int, str] = {}
|
|
350
359
|
token_usage: Optional["CompletionUsage"] = None
|
|
351
360
|
throttled_create = self.rate_limiter._alimit(self.client.chat.completions.create)
|
|
@@ -395,7 +404,7 @@ class OpenAIStreamingClient(PlaygroundStreamingClient):
|
|
|
395
404
|
content: JSONScalarType,
|
|
396
405
|
tool_call_id: Optional[str] = None,
|
|
397
406
|
tool_calls: Optional[list[JSONScalarType]] = None,
|
|
398
|
-
) -> "ChatCompletionMessageParam":
|
|
407
|
+
) -> Optional["ChatCompletionMessageParam"]:
|
|
399
408
|
from openai.types.chat import (
|
|
400
409
|
ChatCompletionAssistantMessageParam,
|
|
401
410
|
ChatCompletionSystemMessageParam,
|
|
@@ -487,6 +496,7 @@ class OpenAIO1StreamingClient(OpenAIStreamingClient):
|
|
|
487
496
|
invocation_name="seed",
|
|
488
497
|
canonical_name=CanonicalParameterName.RANDOM_SEED,
|
|
489
498
|
label="Seed",
|
|
499
|
+
default_value=0,
|
|
490
500
|
),
|
|
491
501
|
JSONInvocationParameter(
|
|
492
502
|
invocation_name="tool_choice",
|
|
@@ -495,65 +505,7 @@ class OpenAIO1StreamingClient(OpenAIStreamingClient):
|
|
|
495
505
|
),
|
|
496
506
|
]
|
|
497
507
|
|
|
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(
|
|
508
|
+
def to_openai_chat_completion_param(
|
|
557
509
|
self,
|
|
558
510
|
role: ChatCompletionMessageRole,
|
|
559
511
|
content: JSONScalarType,
|
|
@@ -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=0.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
|
),
|
|
@@ -867,21 +826,25 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
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
|
BoundedFloatInvocationParameter(
|
|
883
845
|
invocation_name="top_k",
|
|
884
846
|
label="Top K",
|
|
847
|
+
default_value=1.0,
|
|
885
848
|
min_value=0.0,
|
|
886
849
|
max_value=1.0,
|
|
887
850
|
),
|
|
@@ -889,6 +852,7 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
889
852
|
invocation_name="seed",
|
|
890
853
|
canonical_name=CanonicalParameterName.RANDOM_SEED,
|
|
891
854
|
label="Seed",
|
|
855
|
+
default_value=0,
|
|
892
856
|
),
|
|
893
857
|
]
|
|
894
858
|
|
|
@@ -923,6 +887,13 @@ class GeminiStreamingClient(PlaygroundStreamingClient):
|
|
|
923
887
|
chat = client.start_chat(history=gemini_message_history)
|
|
924
888
|
stream = await chat.send_message_async(**gemini_params)
|
|
925
889
|
async for event in stream:
|
|
890
|
+
self._attributes.update(
|
|
891
|
+
{
|
|
892
|
+
LLM_TOKEN_COUNT_PROMPT: event.usage_metadata.prompt_token_count,
|
|
893
|
+
LLM_TOKEN_COUNT_COMPLETION: event.usage_metadata.candidates_token_count,
|
|
894
|
+
LLM_TOKEN_COUNT_TOTAL: event.usage_metadata.total_token_count,
|
|
895
|
+
}
|
|
896
|
+
)
|
|
926
897
|
yield TextChunk(content=event.text)
|
|
927
898
|
|
|
928
899
|
def _build_gemini_messages(
|
|
@@ -25,6 +25,7 @@ from typing_extensions import assert_never
|
|
|
25
25
|
from phoenix.datetime_utils import local_now, normalize_datetime
|
|
26
26
|
from phoenix.db import models
|
|
27
27
|
from phoenix.db.helpers import get_dataset_example_revisions
|
|
28
|
+
from phoenix.server.api.auth import IsNotReadOnly
|
|
28
29
|
from phoenix.server.api.context import Context
|
|
29
30
|
from phoenix.server.api.exceptions import BadRequest, CustomGraphQLError, NotFound
|
|
30
31
|
from phoenix.server.api.helpers.playground_clients import (
|
|
@@ -67,6 +68,7 @@ from phoenix.utilities.json import jsonify
|
|
|
67
68
|
from phoenix.utilities.template_formatters import (
|
|
68
69
|
FStringTemplateFormatter,
|
|
69
70
|
MustacheTemplateFormatter,
|
|
71
|
+
NoOpFormatter,
|
|
70
72
|
TemplateFormatter,
|
|
71
73
|
)
|
|
72
74
|
|
|
@@ -117,7 +119,7 @@ class ChatCompletionOverDatasetMutationPayload:
|
|
|
117
119
|
|
|
118
120
|
@strawberry.type
|
|
119
121
|
class ChatCompletionMutationMixin:
|
|
120
|
-
@strawberry.mutation
|
|
122
|
+
@strawberry.mutation(permission_classes=[IsNotReadOnly]) # type: ignore
|
|
121
123
|
@classmethod
|
|
122
124
|
async def chat_completion_over_dataset(
|
|
123
125
|
cls,
|
|
@@ -272,7 +274,7 @@ class ChatCompletionMutationMixin:
|
|
|
272
274
|
payload.examples.append(example_payload)
|
|
273
275
|
return payload
|
|
274
276
|
|
|
275
|
-
@strawberry.mutation
|
|
277
|
+
@strawberry.mutation(permission_classes=[IsNotReadOnly]) # type: ignore
|
|
276
278
|
@classmethod
|
|
277
279
|
async def chat_completion(
|
|
278
280
|
cls, info: Info[Context, None], input: ChatCompletionInput
|
|
@@ -481,6 +483,8 @@ def _template_formatter(template_language: TemplateLanguage) -> TemplateFormatte
|
|
|
481
483
|
return MustacheTemplateFormatter()
|
|
482
484
|
if template_language is TemplateLanguage.F_STRING:
|
|
483
485
|
return FStringTemplateFormatter()
|
|
486
|
+
if template_language is TemplateLanguage.NONE:
|
|
487
|
+
return NoOpFormatter()
|
|
484
488
|
assert_never(template_language)
|
|
485
489
|
|
|
486
490
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import logging
|
|
3
|
-
from asyncio import FIRST_COMPLETED, Queue, QueueEmpty, Task, create_task, wait, wait_for
|
|
4
3
|
from collections.abc import AsyncIterator, Iterator
|
|
5
4
|
from datetime import datetime, timedelta, timezone
|
|
6
5
|
from typing import (
|
|
7
6
|
Any,
|
|
8
7
|
AsyncGenerator,
|
|
8
|
+
Coroutine,
|
|
9
9
|
Iterable,
|
|
10
10
|
Mapping,
|
|
11
11
|
Optional,
|
|
@@ -24,6 +24,7 @@ from typing_extensions import TypeAlias, assert_never
|
|
|
24
24
|
|
|
25
25
|
from phoenix.datetime_utils import local_now, normalize_datetime
|
|
26
26
|
from phoenix.db import models
|
|
27
|
+
from phoenix.server.api.auth import IsNotReadOnly
|
|
27
28
|
from phoenix.server.api.context import Context
|
|
28
29
|
from phoenix.server.api.exceptions import BadRequest, CustomGraphQLError, NotFound
|
|
29
30
|
from phoenix.server.api.helpers.playground_clients import (
|
|
@@ -63,6 +64,7 @@ from phoenix.server.types import DbSessionFactory
|
|
|
63
64
|
from phoenix.utilities.template_formatters import (
|
|
64
65
|
FStringTemplateFormatter,
|
|
65
66
|
MustacheTemplateFormatter,
|
|
67
|
+
NoOpFormatter,
|
|
66
68
|
TemplateFormatter,
|
|
67
69
|
TemplateFormatterError,
|
|
68
70
|
)
|
|
@@ -86,7 +88,7 @@ PLAYGROUND_PROJECT_NAME = "playground"
|
|
|
86
88
|
|
|
87
89
|
@strawberry.type
|
|
88
90
|
class Subscription:
|
|
89
|
-
@strawberry.subscription
|
|
91
|
+
@strawberry.subscription(permission_classes=[IsNotReadOnly]) # type: ignore
|
|
90
92
|
async def chat_completion(
|
|
91
93
|
self, info: Info[Context, None], input: ChatCompletionInput
|
|
92
94
|
) -> AsyncIterator[ChatCompletionSubscriptionPayload]:
|
|
@@ -161,7 +163,7 @@ class Subscription:
|
|
|
161
163
|
info.context.event_queue.put(SpanInsertEvent(ids=(playground_project_id,)))
|
|
162
164
|
yield ChatCompletionSubscriptionResult(span=to_gql_span(db_span))
|
|
163
165
|
|
|
164
|
-
@strawberry.subscription
|
|
166
|
+
@strawberry.subscription(permission_classes=[IsNotReadOnly]) # type: ignore
|
|
165
167
|
async def chat_completion_over_dataset(
|
|
166
168
|
self, info: Info[Context, None], input: ChatCompletionOverDatasetInput
|
|
167
169
|
) -> AsyncIterator[ChatCompletionSubscriptionPayload]:
|
|
@@ -286,7 +288,7 @@ class Subscription:
|
|
|
286
288
|
experiment=to_gql_experiment(experiment)
|
|
287
289
|
) # eagerly yields experiment so it can be linked by consumers of the subscription
|
|
288
290
|
|
|
289
|
-
results: Queue[ChatCompletionResult] = Queue()
|
|
291
|
+
results: asyncio.Queue[ChatCompletionResult] = asyncio.Queue()
|
|
290
292
|
not_started: list[tuple[DatasetExampleID, ChatStream]] = [
|
|
291
293
|
(
|
|
292
294
|
GlobalID(DatasetExample.__name__, str(revision.dataset_example_id)),
|
|
@@ -302,7 +304,11 @@ class Subscription:
|
|
|
302
304
|
for revision in revisions
|
|
303
305
|
]
|
|
304
306
|
in_progress: list[
|
|
305
|
-
tuple[
|
|
307
|
+
tuple[
|
|
308
|
+
Optional[DatasetExampleID],
|
|
309
|
+
ChatStream,
|
|
310
|
+
asyncio.Task[ChatCompletionSubscriptionPayload],
|
|
311
|
+
]
|
|
306
312
|
] = []
|
|
307
313
|
max_in_progress = 3
|
|
308
314
|
write_batch_size = 10
|
|
@@ -314,7 +320,9 @@ class Subscription:
|
|
|
314
320
|
task = _create_task_with_timeout(stream)
|
|
315
321
|
in_progress.append((ex_id, stream, task))
|
|
316
322
|
async_tasks_to_run = [task for _, _, task in in_progress]
|
|
317
|
-
completed_tasks, _ = await wait(
|
|
323
|
+
completed_tasks, _ = await asyncio.wait(
|
|
324
|
+
async_tasks_to_run, return_when=asyncio.FIRST_COMPLETED
|
|
325
|
+
)
|
|
318
326
|
for completed_task in completed_tasks:
|
|
319
327
|
idx = [task for _, _, task in in_progress].index(completed_task)
|
|
320
328
|
example_id, stream, _ = in_progress[idx]
|
|
@@ -326,7 +334,7 @@ class Subscription:
|
|
|
326
334
|
del in_progress[idx] # removes timed-out stream
|
|
327
335
|
if example_id is not None:
|
|
328
336
|
yield ChatCompletionSubscriptionError(
|
|
329
|
-
message="
|
|
337
|
+
message="Playground task timed out", dataset_example_id=example_id
|
|
330
338
|
)
|
|
331
339
|
except Exception as error:
|
|
332
340
|
del in_progress[idx] # removes failed stream
|
|
@@ -367,7 +375,7 @@ async def _stream_chat_completion_over_dataset_example(
|
|
|
367
375
|
input: ChatCompletionOverDatasetInput,
|
|
368
376
|
llm_client: PlaygroundStreamingClient,
|
|
369
377
|
revision: models.DatasetExampleRevision,
|
|
370
|
-
results: Queue[ChatCompletionResult],
|
|
378
|
+
results: asyncio.Queue[ChatCompletionResult],
|
|
371
379
|
experiment_id: int,
|
|
372
380
|
project_id: int,
|
|
373
381
|
) -> ChatStream:
|
|
@@ -469,23 +477,52 @@ def _is_result_payloads_stream(
|
|
|
469
477
|
|
|
470
478
|
def _create_task_with_timeout(
|
|
471
479
|
iterable: AsyncIterator[GenericType], timeout_in_seconds: int = 90
|
|
472
|
-
) -> Task[GenericType]:
|
|
473
|
-
return create_task(
|
|
480
|
+
) -> asyncio.Task[GenericType]:
|
|
481
|
+
return asyncio.create_task(
|
|
482
|
+
_wait_for(
|
|
483
|
+
_as_coroutine(iterable),
|
|
484
|
+
timeout=timeout_in_seconds,
|
|
485
|
+
timeout_message="Playground task timed out",
|
|
486
|
+
)
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
async def _wait_for(
|
|
491
|
+
coro: Coroutine[None, None, GenericType],
|
|
492
|
+
timeout: float,
|
|
493
|
+
timeout_message: Optional[str] = None,
|
|
494
|
+
) -> GenericType:
|
|
495
|
+
"""
|
|
496
|
+
A function that imitates asyncio.wait_for, but allows the task to be
|
|
497
|
+
cancelled with a custom message.
|
|
498
|
+
"""
|
|
499
|
+
task = asyncio.create_task(coro)
|
|
500
|
+
done, pending = await asyncio.wait([task], timeout=timeout)
|
|
501
|
+
assert len(done) + len(pending) == 1
|
|
502
|
+
if done:
|
|
503
|
+
task = done.pop()
|
|
504
|
+
return task.result()
|
|
505
|
+
task = pending.pop()
|
|
506
|
+
task.cancel(msg=timeout_message)
|
|
507
|
+
try:
|
|
508
|
+
return await task
|
|
509
|
+
except asyncio.CancelledError:
|
|
510
|
+
raise asyncio.TimeoutError()
|
|
474
511
|
|
|
475
512
|
|
|
476
|
-
async def _drain(queue: Queue[GenericType]) -> list[GenericType]:
|
|
513
|
+
async def _drain(queue: asyncio.Queue[GenericType]) -> list[GenericType]:
|
|
477
514
|
values: list[GenericType] = []
|
|
478
515
|
while not queue.empty():
|
|
479
516
|
values.append(await queue.get())
|
|
480
517
|
return values
|
|
481
518
|
|
|
482
519
|
|
|
483
|
-
def _drain_no_wait(queue: Queue[GenericType]) -> list[GenericType]:
|
|
520
|
+
def _drain_no_wait(queue: asyncio.Queue[GenericType]) -> list[GenericType]:
|
|
484
521
|
values: list[GenericType] = []
|
|
485
522
|
while True:
|
|
486
523
|
try:
|
|
487
524
|
values.append(queue.get_nowait())
|
|
488
|
-
except QueueEmpty:
|
|
525
|
+
except asyncio.QueueEmpty:
|
|
489
526
|
break
|
|
490
527
|
return values
|
|
491
528
|
|
|
@@ -526,6 +563,8 @@ def _template_formatter(template_language: TemplateLanguage) -> TemplateFormatte
|
|
|
526
563
|
return MustacheTemplateFormatter()
|
|
527
564
|
if template_language is TemplateLanguage.F_STRING:
|
|
528
565
|
return FStringTemplateFormatter()
|
|
566
|
+
if template_language is TemplateLanguage.NONE:
|
|
567
|
+
return NoOpFormatter()
|
|
529
568
|
assert_never(template_language)
|
|
530
569
|
|
|
531
570
|
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_components-
|
|
3
|
-
"file": "assets/components-
|
|
2
|
+
"_components-72cQL1d1.js": {
|
|
3
|
+
"file": "assets/components-72cQL1d1.js",
|
|
4
4
|
"name": "components",
|
|
5
5
|
"imports": [
|
|
6
|
-
"_vendor-
|
|
7
|
-
"_pages-
|
|
8
|
-
"_vendor-arizeai
|
|
9
|
-
"_vendor-codemirror-
|
|
6
|
+
"_vendor-DexmGnha.js",
|
|
7
|
+
"_pages-DFAkBAUh.js",
|
|
8
|
+
"_vendor-arizeai--Q3ol330.js",
|
|
9
|
+
"_vendor-codemirror-B4bYvWa6.js",
|
|
10
10
|
"_vendor-three-DwGkEfCM.js"
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
|
-
"_pages-
|
|
14
|
-
"file": "assets/pages-
|
|
13
|
+
"_pages-DFAkBAUh.js": {
|
|
14
|
+
"file": "assets/pages-DFAkBAUh.js",
|
|
15
15
|
"name": "pages",
|
|
16
16
|
"imports": [
|
|
17
|
-
"_vendor-
|
|
18
|
-
"_vendor-arizeai
|
|
19
|
-
"_components-
|
|
20
|
-
"_vendor-recharts-
|
|
21
|
-
"_vendor-codemirror-
|
|
17
|
+
"_vendor-DexmGnha.js",
|
|
18
|
+
"_vendor-arizeai--Q3ol330.js",
|
|
19
|
+
"_components-72cQL1d1.js",
|
|
20
|
+
"_vendor-recharts-B4ZzJhNh.js",
|
|
21
|
+
"_vendor-codemirror-B4bYvWa6.js"
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"_vendor-!~{003}~.js": {
|
|
25
25
|
"file": "assets/vendor-DxkFTwjz.css",
|
|
26
26
|
"src": "_vendor-!~{003}~.js"
|
|
27
27
|
},
|
|
28
|
-
"_vendor-
|
|
29
|
-
"file": "assets/vendor-
|
|
28
|
+
"_vendor-DexmGnha.js": {
|
|
29
|
+
"file": "assets/vendor-DexmGnha.js",
|
|
30
30
|
"name": "vendor",
|
|
31
31
|
"imports": [
|
|
32
32
|
"_vendor-three-DwGkEfCM.js"
|
|
@@ -35,25 +35,25 @@
|
|
|
35
35
|
"assets/vendor-DxkFTwjz.css"
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
|
-
"_vendor-arizeai
|
|
39
|
-
"file": "assets/vendor-arizeai
|
|
38
|
+
"_vendor-arizeai--Q3ol330.js": {
|
|
39
|
+
"file": "assets/vendor-arizeai--Q3ol330.js",
|
|
40
40
|
"name": "vendor-arizeai",
|
|
41
41
|
"imports": [
|
|
42
|
-
"_vendor-
|
|
42
|
+
"_vendor-DexmGnha.js"
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
|
-
"_vendor-codemirror-
|
|
46
|
-
"file": "assets/vendor-codemirror-
|
|
45
|
+
"_vendor-codemirror-B4bYvWa6.js": {
|
|
46
|
+
"file": "assets/vendor-codemirror-B4bYvWa6.js",
|
|
47
47
|
"name": "vendor-codemirror",
|
|
48
48
|
"imports": [
|
|
49
|
-
"_vendor-
|
|
49
|
+
"_vendor-DexmGnha.js"
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
|
-
"_vendor-recharts-
|
|
53
|
-
"file": "assets/vendor-recharts-
|
|
52
|
+
"_vendor-recharts-B4ZzJhNh.js": {
|
|
53
|
+
"file": "assets/vendor-recharts-B4ZzJhNh.js",
|
|
54
54
|
"name": "vendor-recharts",
|
|
55
55
|
"imports": [
|
|
56
|
-
"_vendor-
|
|
56
|
+
"_vendor-DexmGnha.js"
|
|
57
57
|
]
|
|
58
58
|
},
|
|
59
59
|
"_vendor-three-DwGkEfCM.js": {
|
|
@@ -61,18 +61,18 @@
|
|
|
61
61
|
"name": "vendor-three"
|
|
62
62
|
},
|
|
63
63
|
"index.tsx": {
|
|
64
|
-
"file": "assets/index-
|
|
64
|
+
"file": "assets/index-BowjltW-.js",
|
|
65
65
|
"name": "index",
|
|
66
66
|
"src": "index.tsx",
|
|
67
67
|
"isEntry": true,
|
|
68
68
|
"imports": [
|
|
69
|
-
"_vendor-
|
|
70
|
-
"_vendor-arizeai
|
|
71
|
-
"_pages-
|
|
72
|
-
"_components-
|
|
69
|
+
"_vendor-DexmGnha.js",
|
|
70
|
+
"_vendor-arizeai--Q3ol330.js",
|
|
71
|
+
"_pages-DFAkBAUh.js",
|
|
72
|
+
"_components-72cQL1d1.js",
|
|
73
73
|
"_vendor-three-DwGkEfCM.js",
|
|
74
|
-
"_vendor-recharts-
|
|
75
|
-
"_vendor-codemirror-
|
|
74
|
+
"_vendor-recharts-B4ZzJhNh.js",
|
|
75
|
+
"_vendor-codemirror-B4bYvWa6.js"
|
|
76
76
|
]
|
|
77
77
|
}
|
|
78
78
|
}
|