camel-ai/camel

[BUG] if self.model_backend.model_config_dict['tools']: KeyError: 'tools'

Closed this issue · 6 comments

Required prerequisites

What version of camel are you using?

0.2.1a

System information

3.10.15 (main, Oct 3 2024, 07:27:34) [GCC 11.2.0] linux
0.2.1a

Problem description

Trying to reproduce Use Open-Source Models as Backends (ex. using Ollama to set Llama 3 locally)

Reproducible example code

I did exactly same thing with README.md

from camel.agents import ChatAgent
from camel.messages import BaseMessage
from camel.models import ModelFactory
from camel.types import ModelPlatformType

ollama_model = ModelFactory.create(
    model_platform=ModelPlatformType.OLLAMA,
    model_type="llama3",
    url="http://localhost:11434/v1",
    model_config_dict={"temperature": 0.4},
)

assistant_sys_msg = BaseMessage.make_assistant_message(
    role_name="Assistant",
    content="You are a helpful assistant.",
)
agent = ChatAgent(assistant_sys_msg, model=ollama_model, token_limit=4096)

user_msg = BaseMessage.make_user_message(
    role_name="User", content="Say hi to CAMEL"
)
assistant_response = agent.step(user_msg)
print(assistant_response.msg.content)

Traceback

Traceback (most recent call last):
  File "/home/juyi/camel/try.py", line 22, in <module>
    assistant_response = agent.step(user_msg)
  File "/home/juyi/camel/camel/agents/chat_agent.py", line 429, in step
    if self.model_backend.model_config_dict['tools']:
KeyError: 'tools'

Expected behavior

No response

Additional context

No response

self.model_backend.model_config_dict only has {'temperature': 0.4}
@Wendong-Fan

Ok, I find it has changed in latest branch, So does git clone -b v0.2.1a https://github.com/camel-ai/camel.git In Install CAMEL from source with conda and pip: is suitable? Whether we could just git clone https://github.com/camel-ai/camel.git to get latest branch

Hey @LukeLIN-web , you can use 0.2.1 version which is stable version of camel, you can also fetch latest code from git, both should works, feel free to reopen this issue if there's any further question~

Should we fix the error first if it is not too difficult ? @Wendong-Fan

Hey @lightaime , it's a bug in v0.2.1a (pre-release version) which already been fixed, but we haven't released v0.2.2 for this fix, user can use v0.2.1 which doesn't have this bug

Ok. But if there is a known bug in the release. We probably should release a pitch version too.

Ok. But if there is a known bug in the release. We probably should release a pitch version too.

Got it