arize-phoenix 1.7.2rc3__py3-none-any.whl → 1.8.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-1.7.2rc3.dist-info → arize_phoenix-1.8.0.dist-info}/METADATA +2 -1
- {arize_phoenix-1.7.2rc3.dist-info → arize_phoenix-1.8.0.dist-info}/RECORD +8 -8
- phoenix/__init__.py +1 -1
- phoenix/server/static/index.js +39 -39
- phoenix/trace/openai/instrumentor.py +22 -7
- {arize_phoenix-1.7.2rc3.dist-info → arize_phoenix-1.8.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-1.7.2rc3.dist-info → arize_phoenix-1.8.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-1.7.2rc3.dist-info → arize_phoenix-1.8.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -615,17 +615,32 @@ def _accumulate_messages(
|
|
|
615
615
|
"""
|
|
616
616
|
if not chunks:
|
|
617
617
|
return []
|
|
618
|
-
|
|
619
|
-
|
|
618
|
+
content_token_lists: DefaultDict[int, List[str]] = defaultdict(list)
|
|
619
|
+
function_argument_token_lists: DefaultDict[int, List[str]] = defaultdict(list)
|
|
620
|
+
function_names: Dict[int, str] = {}
|
|
621
|
+
roles: Dict[int, str] = {}
|
|
620
622
|
for chunk in chunks:
|
|
621
623
|
for choice in chunk.choices:
|
|
622
624
|
choice_index = choice.index
|
|
623
|
-
if
|
|
624
|
-
|
|
625
|
+
if content_token := choice.delta.content:
|
|
626
|
+
content_token_lists[choice_index].append(content_token)
|
|
627
|
+
if function_call := choice.delta.function_call:
|
|
628
|
+
if function_name := function_call.name:
|
|
629
|
+
function_names[choice_index] = function_name
|
|
630
|
+
if (function_argument_token := function_call.arguments) is not None:
|
|
631
|
+
function_argument_token_lists[choice_index].append(function_argument_token)
|
|
625
632
|
if role := choice.delta.role:
|
|
626
633
|
roles[choice_index] = role
|
|
627
634
|
messages: List[OpenInferenceMessage] = [{} for _ in range(num_choices)]
|
|
628
|
-
for choice_index in range(
|
|
629
|
-
|
|
630
|
-
|
|
635
|
+
for choice_index in range(num_choices):
|
|
636
|
+
if (role_ := roles.get(choice_index)) is not None:
|
|
637
|
+
messages[choice_index][MESSAGE_ROLE] = role_
|
|
638
|
+
if content_token_list := content_token_lists[choice_index]:
|
|
639
|
+
messages[choice_index][MESSAGE_CONTENT] = "".join(content_token_list)
|
|
640
|
+
if (function_name := function_names.get(choice_index)) is not None:
|
|
641
|
+
messages[choice_index][MESSAGE_FUNCTION_CALL_NAME] = function_name
|
|
642
|
+
if function_argument_token_list := function_argument_token_lists[choice_index]:
|
|
643
|
+
messages[choice_index][MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON] = "".join(
|
|
644
|
+
function_argument_token_list
|
|
645
|
+
)
|
|
631
646
|
return messages
|
|
File without changes
|
|
File without changes
|
|
File without changes
|