Skip to content

Commit

Permalink
feat: Serializable execution details (#3358)
Browse files Browse the repository at this point in the history
* Simplify output types for `llm_classify` with execution info

* Update notebook

* Ruff 🐶

* Fix typos
  • Loading branch information
anticorrelator authored May 31, 2024
1 parent dc18123 commit fc74513
Show file tree
Hide file tree
Showing 3 changed files with 1,656 additions and 10 deletions.
12 changes: 10 additions & 2 deletions packages/phoenix-evals/src/phoenix/evals/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,16 @@ def _run_llm_classification_sync(input_data: pd.Series[Any]) -> ParsedLLMRespons
**({"explanation": explanations} if provide_explanation else {}),
**({"prompt": prompts} if include_prompt else {}),
**({"response": responses} if include_response else {}),
**({"exceptions": all_exceptions} if include_exceptions else {}),
**({"execution_status": classification_statuses} if include_exceptions else {}),
**(
{"exceptions": [[repr(exc) for exc in excs] for excs in all_exceptions]}
if include_exceptions
else {}
),
**(
{"execution_status": [status.value for status in classification_statuses]}
if include_exceptions
else {}
),
},
index=dataframe.index,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,10 @@ def test_classify_exits_on_missing_input(
)

assert classification_df["execution_status"].tolist() == [
ClassificationStatus.COMPLETED,
ClassificationStatus.COMPLETED,
ClassificationStatus.MISSING_INPUT,
ClassificationStatus.DID_NOT_RUN,
ClassificationStatus.COMPLETED.value,
ClassificationStatus.COMPLETED.value,
ClassificationStatus.MISSING_INPUT.value,
ClassificationStatus.DID_NOT_RUN.value,
]

exceptions = classification_df["exceptions"].tolist()
Expand Down Expand Up @@ -525,10 +525,10 @@ def test_classify_skips_missing_input_with_when_exit_on_error_false(
)

assert classification_df["execution_status"].tolist() == [
ClassificationStatus.COMPLETED,
ClassificationStatus.COMPLETED,
ClassificationStatus.MISSING_INPUT,
ClassificationStatus.FAILED,
ClassificationStatus.COMPLETED.value,
ClassificationStatus.COMPLETED.value,
ClassificationStatus.MISSING_INPUT.value,
ClassificationStatus.FAILED.value,
]

exceptions = classification_df["exceptions"].tolist()
Expand Down
Loading

0 comments on commit fc74513

Please sign in to comment.