You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal is to simplify interface to enable creating a ChatAgent with one line of code.
The currect interface for create a ChatAgent with a model is like this:
from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType
from camel.agents import ChatAgent
# Define the model, here in this case we use gpt-4o-mini
model = ModelFactory.create(
model_platform=ModelPlatformType.OPENAI,
model_type=ModelType.GPT_4O_MINI,
)
# Initialize the agent
ChatAgent("You are a helpful assistant.", model=model)
By supporting str like behaviour for ModelPlatformType we can do:
from camel.models import ModelFactory
from camel.agents import ChatAgent
# Define the model, here in this case we use gpt-4o-mini
model = ModelFactory.create(
model_platform="openai",
model_type="gpt-4o-mini",
)
# Initialize the agent
ChatAgent("You are a helpful assistant.", model=model)
By creating model inside ChatAgent with differnt if-else conditions we can do:
from camel.agents import ChatAgent
# Initialize the agent with a `tuple`
ChatAgent("You are a helpful assistant.", model=("openai", "gpt-4o-mini"))
# Or just a `str` for model type. Try to find the corresponding `ModelPlatformType` or use default `ModelPlatformType`
ChatAgent("You are a helpful assistant.", model="gpt-4o-mini")
Of course we can also support:
from camel.agents import ChatAgent
from camel.types import ModelPlatformType, ModelType
# Initialize the agent with a `tuple` of `enum`
ChatAgent("You are a helpful assistant.", model=(ModelPlatformType.OPENAI, ModelType.GPT_4O_MINI))
# Or just a `enum` for model type. Try to find the corresponding `ModelPlatformType` or use default `ModelPlatformType`
ChatAgent("You are a helpful assistant.", model=ModelType.GPT_4O_MINI)
The text was updated successfully, but these errors were encountered:
lightaime
changed the title
Support str for ModelPlatformType like ModelType to simplify interface
Support str like behaviour for ModelPlatformType like ModelType to simplify interface
Mar 2, 2025
The goal is to simplify interface to enable creating a
ChatAgent
with one line of code.The currect interface for create a
ChatAgent
with a model is like this:By supporting
str
like behaviour forModelPlatformType
we can do:By creating
model
insideChatAgent
with differnt if-else conditions we can do:Of course we can also support:
The text was updated successfully, but these errors were encountered: