Fix issue #4739: '[Bug]: The agent doesn'"'"'t know its name' (#4740)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Graham Neubig <neubig@gmail.com>
This commit is contained in:
Xingyao Wang
2024-11-04 15:24:35 -06:00
committed by GitHub
parent ba25b02978
commit 1d2a616be7
28 changed files with 30 additions and 30 deletions

View File

@@ -279,4 +279,3 @@ Cette fonction fait ce qui suit :
3. Si l'agent a fait plusieurs tentatives, il lui donne la possibilité d'abandonner
En utilisant cette fonction, vous pouvez garantir un comportement cohérent sur plusieurs exécutions d'évaluation et empêcher l'agent de rester bloqué en attendant une entrée humaine.

View File

@@ -58,4 +58,3 @@ docker run -it \
ghcr.io/all-hands-ai/openhands:0.11 \
python -m openhands.core.main -t "write a bash script that prints hi"
```

View File

@@ -84,4 +84,3 @@ all the preprocessing/evaluation/analysis scripts.
- Raw data and experimental records should not be stored within this repo.
- For model outputs, they should be stored at [this huggingface space](https://huggingface.co/spaces/OpenHands/evaluation) for visualization.
- Important data files of manageable size and analysis scripts (e.g., jupyter notebooks) can be directly uploaded to this repo.

View File

@@ -78,4 +78,3 @@ describe("extractModelAndProvider", () => {
});
});
});

View File

@@ -63,4 +63,3 @@ test("organizeModelsAndProviders", () => {
},
});
});

View File

@@ -25,9 +25,10 @@ from openhands.events.action import (
)
from openhands.events.tool import ToolCallMetadata
SYSTEM_PROMPT = """You are a helpful assistant that can interact with a computer to solve tasks.
SYSTEM_PROMPT = """You are OpenHands agent, a helpful AI assistant that can interact with a computer to solve tasks.
<IMPORTANT>
* If user provides a path, you should NOT assume it's relative to the current working directory. Instead, you should explore the file system to find the file before working on it.
* When configuring git credentials, use "openhands" as the user.name and "openhands@all-hands.dev" as the user.email by default, unless explicitly instructed otherwise.
</IMPORTANT>
"""

View File

@@ -304,7 +304,7 @@ class EventStreamRuntime(Runtime):
volumes = None
self.log(
'debug',
f'Sandbox workspace: {self.config.workspace_mount_path_in_sandbox}'
f'Sandbox workspace: {self.config.workspace_mount_path_in_sandbox}',
)
if self.config.sandbox.browsergym_eval_env is not None:

View File

@@ -175,7 +175,9 @@ def build_runtime_image_in_folder(
logger.info(f'Building image: {hash_image_name}')
if force_rebuild:
logger.debug(f'Force rebuild: [{runtime_image_repo}:{source_tag}] from scratch.')
logger.debug(
f'Force rebuild: [{runtime_image_repo}:{source_tag}] from scratch.'
)
prep_build_folder(
build_folder,
base_image,

View File

@@ -1,12 +1,11 @@
from tenacity import RetryCallState
from tenacity.stop import stop_base
from openhands.runtime.utils.shutdown_listener import should_exit
class stop_if_should_exit(stop_base):
"""Stop if the should_exit flag is set."""
def __call__(self, retry_state: "RetryCallState") -> bool:
def __call__(self, retry_state: 'RetryCallState') -> bool:
return should_exit()

View File

@@ -126,8 +126,10 @@ class AgentSession:
def close(self):
"""Closes the Agent session"""
self._closed = True
def inner_close():
asyncio.run(self._close())
asyncio.get_event_loop().run_in_executor(None, inner_close)
async def _close(self):
@@ -142,7 +144,6 @@ class AgentSession:
if self.security_analyzer is not None:
await self.security_analyzer.close()
def _create_security_analyzer(self, security_analyzer: str | None):
"""Creates a SecurityAnalyzer instance that will be used to analyze the agent actions

View File

@@ -92,6 +92,7 @@ reportlab = "*"
[tool.coverage.run]
concurrency = ["gevent"]
[tool.poetry.group.runtime.dependencies]
jupyterlab = "*"
notebook = "*"
@@ -122,6 +123,7 @@ ignore = ["D1"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.poetry.group.evaluation.dependencies]
streamlit = "*"
whatthepatch = "*"