-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Error during parsing ollama return. #5090
Comments
I'm unfortunately not familiar with ollama at all. Does it work? Set the model and base url through the UI. |
This is a bug, solved in this PR. |
Worked yesterday but now it throws this:
|
@AidyTheWeird oh, on the PR branch? Sorry about that, yes, I thought it was working, but I needed to refactor the code and it might be broken right now. Could you tell how you were running it? If via git, then |
I run through docker
edit: trying |
I think you're right, the second should work and/or it might take a bit to finish CI |
Is there an existing issue for the same bug?
Describe the bug and reproduction steps
I'm tring local ollama qwen2.5coder 32b model. Agent tried to get content field which doesn't exist. The command I used to start openhands is
docker run -it \ --rm \ --pull=always \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.14-nikolaik \ -e SANDBOX_USER_ID=$(id -u) \ -e WORKSPACE_MOUNT_PATH=/home/papillon/eden/apple \ -e LLM_MODEL=ollama/qwen \ -e LLM_OLLAMA_BASE_URL=http://host.docker.internal:11435 \ -e LLM_BASE_URL=http://host.docker.internal:11435 \ -v /home/papillon/eden/apple:/workspace \ -v /var/run/docker.sock:/var/run/docker.sock \ --add-host host.docker.internal:host-gateway \ --name openhands-app-apple \ docker.all-hands.dev/all-hands-ai/openhands:0.14 \ python -m openhands.core.cli
and error I got is
Traceback (most recent call last):
File "/app/openhands/controller/agent_controller.py", line 202, in start_step_loop
await self._step()
File "/app/openhands/controller/agent_controller.py", line 483, in _step
action = self.agent.step(self.state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/openhands/agenthub/codeact_agent/codeact_agent.py", line 334, in step
response = self.llm.completion(**params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 336, in wrapped_f
return copy(f, *args, **kw)
^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 475, in call
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 376, in iter
result = action(retry_state)
^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 398, in
self._add_action_func(lambda rs: rs.outcome.result())
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/app/.venv/lib/python3.12/site-packages/tenacity/init.py", line 478, in call
result = fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/app/openhands/llm/llm.py", line 196, in wrapper
messages = convert_fncall_messages_to_non_fncall_messages(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/openhands/llm/fn_call_converter.py", line 322, in convert_fncall_messages_to_non_fncall_messages
role, content = message['role'], message['content']
~~~~~~~^^^^^^^^^^^
KeyError: 'content'
I also have a proxy to log transcript between agent and ollama. Here is the chat log.
Time: 2024-11-17 05:53:16
Endpoint: /api/generate
Request:
{
"model": "qwen",
"prompt": "--------------------- NEW TASK DESCRIPTION ---------------------\n/workspace目录下有哪些文件?--------------------- END OF NEW TASK DESCRIPTION ---------------------\n\nPLEASE follow the format strictly! PLEASE EMIT ONE AND ONLY ONE FUNCTION CALL PER MESSAGE.\n\n\n",
"options": {
"temperature": 0.0,
"top_p": 1.0,
"stop": [
"</function"
]
},
"stream": false
}
Response:
{
"model": "qwen",
"created_at": "2024-11-17T10:53:28.121734314Z",
"response": "<function=execute_bash>\n<parameter=command>\nls /workspace\n\n",
"done": true,
"done_reason": "stop",
"context": [
151644,
8948,
198,
...
],
"total_duration": 11151593064,
"load_duration": 14279532,
"prompt_eval_count": 4042,
"prompt_eval_duration": 626000000,
"eval_count": 21,
"eval_duration": 10510000000
}
OpenHands Installation
Docker command in README
OpenHands Version
0.14
Operating System
Linux
Logs, Errors, Screenshots, and Additional Context
No response
The text was updated successfully, but these errors were encountered: