-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update models.md, add yi_model_example
- Loading branch information
1 parent
f7f699e
commit 638b971
Showing
3 changed files
with
59 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== | ||
# Licensed under the Apache License, Version 2.0 (the “License”); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an “AS IS” BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== | ||
|
||
from camel.agents import ChatAgent | ||
from camel.configs import YiConfig | ||
from camel.messages import BaseMessage | ||
from camel.models import ModelFactory | ||
from camel.types import ModelPlatformType, ModelType | ||
|
||
model = ModelFactory.create( | ||
model_platform=ModelPlatformType.YI, | ||
model_type=ModelType.YI_LIGHTNING, | ||
model_config_dict=YiConfig(temperature=0.2).as_dict(), | ||
) | ||
|
||
# Define system message | ||
sys_msg = BaseMessage.make_assistant_message( | ||
role_name="Assistant", | ||
content="You are a helpful assistant.", | ||
) | ||
|
||
# Set agent | ||
camel_agent = ChatAgent(system_message=sys_msg, model=model) | ||
|
||
user_msg = BaseMessage.make_user_message( | ||
role_name="User", | ||
content="""Say hi to CAMEL AI, one open-source community | ||
dedicated to the study of autonomous and communicative agents.""", | ||
) | ||
|
||
# Get response information | ||
response = camel_agent.step(user_msg) | ||
print(response.msgs[0].content) | ||
''' | ||
=============================================================================== | ||
Hello CAMEL AI community! 👋 It's great to connect with an open-source group | ||
dedicated to the fascinating fields of autonomous and communicative agents. If | ||
there's anything you need assistance with or any interesting projects you're | ||
working on, feel free to share. I'm here to help however I can! 😊 | ||
=============================================================================== | ||
''' |