π OpenHands: AI-Driven Development
[Fix] Stop API key from leaking in evaluation outputs. (#3603)
Raj Maheshwarie72dc96d13c0
diff --git a/agenthub/codeact_agent/README.md b/agenthub/codeact_agent/README.mdindex 25d2b8c9a4..c2525c0728 100644--- a/agenthub/codeact_agent/README.md+++ b/agenthub/codeact_agent/README.md@@ -15,7 +15,7 @@ The conceptual idea is illustrated below. At each turn, the agent can:To make the CodeAct agent more powerful with only access to `bash` action space, CodeAct agent leverages OpenHands's plugin system:- [Jupyter plugin](https://github.com/All-Hands-AI/OpenHands/tree/main/openhands/runtime/plugins/jupyter): for IPython execution via bash command-- [SWE-agent tool plugin](https://github.com/All-Hands-AI/OpenHands/tree/main/openhands/runtime/plugins/swe_agent_commands): Powerful bash command line tools for software development tasks introduced by [swe-agent](https://github.com/princeton-nlp/swe-agent).+- [Agent Skills plugin](https://github.com/All-Hands-AI/OpenHands/tree/main/openhands/runtime/plugins/agent_skills): Powerful bash command line tools for software development tasks introduced by [swe-agent](https://github.com/princeton-nlp/swe-agent).## Demodiff --git a/evaluation/utils/shared.py b/evaluation/utils/shared.pyindex d841a7b29a..9c9c1cd3f8 100644--- a/evaluation/utils/shared.py+++ b/evaluation/utils/shared.py@@ -32,6 +32,12 @@ class EvalMetadata(BaseModel):data_split: str | None = Nonedetails: dict[str, Any] | None = None+ def model_dump(self, *args, **kwargs):+ dumped_dict = super().model_dump(*args, **kwargs)+ # avoid leaking sensitive information+ dumped_dict['llm_config'] = self.llm_config.to_safe_dict()+ return dumped_dict+def model_dump_json(self, *args, **kwargs):dumped = super().model_dump_json(*args, **kwargs)dumped_dict = json.loads(dumped)@@ -58,6 +64,12 @@ class EvalOutput(BaseModel):# Optionally save the input test instanceinstance: dict[str, Any] | None = None+ def model_dump(self, *args, **kwargs):+ dumped_dict = super().model_dump(*args, **kwargs)+ # Apply custom serialization for metadata (to avoid leaking sensitive information)+ dumped_dict['metadata'] = self.metadata.model_dump()+ return dumped_dict+def model_dump_json(self, *args, **kwargs):dumped = super().model_dump_json(*args, **kwargs)dumped_dict = json.loads(dumped)