camel-ai / camel

🐫 CAMEL: Finding the Scaling Law of Agents. A multi-agent framework. https://www.camel-ai.org
https://docs.camel-ai.org/
Apache License 2.0
5.41k stars 665 forks source link

[BUG] Argument Error in ModelFactory.create(): Unexpected keyword argument 'model_config' #708

Closed Appointat closed 3 months ago

Appointat commented 3 months ago

Required prerequisites

What version of camel are you using?

main branch (05 07 2024)

System information

Python version: 3.11

Problem description

When using the ModelFactory.create() method, a TypeError is encountered, indicating that the method does not accept a model_config parameter. This may be due to methodes changes in the latest version of the CAMEL library.

Reproducible example code

from camel.configs import AnthropicConfig from camel.models import ModelFactory from camel.societies import RolePlaying from camel.types import ModelPlatformType, ModelType

def main(model_type=None): agent_kwargs = { role: ModelFactory.create( model_platform=ModelPlatformType.ANTHROPIC, model_type=model_type, model_config=AnthropicConfig(), ) for role in ["assistant", "user", "task-specify"] }

... rest of the code ...

if name == "main": main(model_type=ModelType.CLAUDE_2_0)

Traceback

Traceback (most recent call last):
  File "\camel\examples\models\role_playing_with_claude.py", line 101, in <module>
    main(model_type=ModelType.CLAUDE_2_0)
  File "\camel\examples\models\role_playing_with_claude.py", line 26, in main
    agent_kwargs = {
                   ^
  File "camel\examples\models\role_playing_with_claude.py", line 27, in <dictcomp>
    role: ModelFactory.create(
          ^^^^^^^^^^^^^^^^^^^^
TypeError: ModelFactory.create() got an unexpected keyword argument 'model_config'

Expected behavior

The ModelFactory.create() method should accept the model_config parameter and successfully create a model instance without raising a TypeError.

Additional context

This error occurs when attempting to use the Claude 2.0 model with the CAMEL library. It's possible that recent changes to the library have modified the signature of the ModelFactory.create() method. It's recommended to check the latest documentation for the CAMEL library to see if the usage of this method has changed. If the method signature has indeed changed, the code may need to be updated to match the new requirements.

Appointat commented 3 months ago

This issue will be fixed very soon.

Wendong-Fan commented 3 months ago

Hey @Appointat , I have one fix PR for this https://github.com/camel-ai/camel/pull/706

Appointat commented 3 months ago

Got it. Thanks!