Skip to content

Commit 2ad5a2e

Browse files
sararobcopybara-github
authored andcommitted
chore: Fix failing flaky tests
PiperOrigin-RevId: 861162801
1 parent 0179aa5 commit 2ad5a2e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

tests/unit/vertexai/test_evaluation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2925,6 +2925,9 @@ def test_rubric_generation_parsing_additional_fields(self):
29252925
critique_metric=metric_prompt_template_examples.MetricPromptTemplateExamples.Pointwise.COHERENCE,
29262926
)
29272927
dataset_with_rubrics = rbm.generate_rubrics(_TEST_EVAL_DATASET_PROMPT_RESPONSE)
2928-
expected = _EXPECTED_EVAL_DATASET_PROMPT_RESPONSE_WITH_RUBRICS
2928+
expected = _EXPECTED_EVAL_DATASET_PROMPT_RESPONSE_WITH_RUBRICS.copy()
29292929
expected["desc"] = ["test_desc", "test_desc", "test_desc"]
2930+
expected["desc"] = expected["desc"].astype(object)
2931+
2932+
assert dataset_with_rubrics.equals(expected)
29302933
assert dataset_with_rubrics.equals(expected)

vertexai/evaluation/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def _load_jsonl(filepath: str) -> "pd.DataFrame":
209209
)
210210
if filepath.startswith(_GCS_PREFIX):
211211
file_contents = _read_gcs_file_contents(filepath)
212-
return pd.read_json(file_contents, lines=True)
212+
return pd.read_json(io.StringIO(file_contents), lines=True)
213213
else:
214214
with open(filepath, "r") as f:
215215
return pd.read_json(f, lines=True)

0 commit comments

Comments
 (0)