You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: add utf-8 encoding to file based reads and writes of eval data
This will help manage encoding consistency between reads and writes. PiperOrigin-RevId: 785503746
This commit is contained in:
committed by
Copybara-Service
parent
9467720919
commit
fc85348f91
@@ -60,7 +60,7 @@ class LocalEvalSetResultsManager(EvalSetResultsManager):
|
||||
eval_set_result.eval_set_result_name + _EVAL_SET_RESULT_FILE_EXTENSION,
|
||||
)
|
||||
logger.info("Writing eval result to file: %s", eval_set_result_file_path)
|
||||
with open(eval_set_result_file_path, "w") as f:
|
||||
with open(eval_set_result_file_path, "w", encoding="utf-8") as f:
|
||||
f.write(json.dumps(eval_set_result_json, indent=2))
|
||||
|
||||
@override
|
||||
@@ -78,7 +78,7 @@ class LocalEvalSetResultsManager(EvalSetResultsManager):
|
||||
)
|
||||
if not os.path.exists(maybe_eval_result_file_path):
|
||||
raise NotFoundError(f"Eval set result `{eval_set_result_id}` not found.")
|
||||
with open(maybe_eval_result_file_path, "r") as file:
|
||||
with open(maybe_eval_result_file_path, "r", encoding="utf-8") as file:
|
||||
eval_result_data = json.load(file)
|
||||
return EvalSetResult.model_validate_json(eval_result_data)
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ class LocalEvalSetsManager(EvalSetsManager):
|
||||
)
|
||||
|
||||
def _write_eval_set_to_path(self, eval_set_path: str, eval_set: EvalSet):
|
||||
with open(eval_set_path, "w") as f:
|
||||
with open(eval_set_path, "w", encoding="utf-8") as f:
|
||||
f.write(eval_set.model_dump_json(indent=2))
|
||||
|
||||
def _save_eval_set(self, app_name: str, eval_set_id: str, eval_set: EvalSet):
|
||||
|
||||
Reference in New Issue
Block a user