Skip to content

Commit

Permalink
feat: Add support for Gemini-Exp-1114 model (#1187) (#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
MuggleJinx authored Nov 19, 2024
1 parent 5a2e4e2 commit d4e2356
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
3 changes: 3 additions & 0 deletions camel/types/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class ModelType(UnifiedModelType, Enum):
# Gemini models
GEMINI_1_5_FLASH = "gemini-1.5-flash"
GEMINI_1_5_PRO = "gemini-1.5-pro"
GEMINI_EXP_1114 = "gemini-exp-1114"

# Mistral AI models
MISTRAL_3B = "ministral-3b-latest"
Expand Down Expand Up @@ -232,6 +233,7 @@ def is_gemini(self) -> bool:
return self in {
ModelType.GEMINI_1_5_FLASH,
ModelType.GEMINI_1_5_PRO,
ModelType.GEMINI_EXP_1114,
}

@property
Expand Down Expand Up @@ -384,6 +386,7 @@ def token_limit(self) -> int:
elif self in {
ModelType.GEMINI_1_5_FLASH,
ModelType.GEMINI_1_5_PRO,
ModelType.GEMINI_EXP_1114, # Not given in docs, assuming the same
}:
return 1_048_576
elif self in {
Expand Down
3 changes: 2 additions & 1 deletion docs/key_modules/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ The following table lists currently supported model platforms by CAMEL.
| Anthropic | claude-3-opus-20240229 | Y |
| Anthropic | claude-2.0 | N |
| Gemini | gemini-1.5-pro | Y |
| Gemini | ggemini-1.5-flash | Y |
| Gemini | gemini-1.5-flash | Y |
| Gemini | gemini-exp-1114 | Y |
| Lingyiwanwu | yi-lightning | N |
| Lingyiwanwu | yi-large | N |
| Lingyiwanwu | yi-medium | N |
Expand Down
30 changes: 30 additions & 0 deletions examples/models/gemini_model_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,33 @@
doing in this area. Keep up the great work! 🤖
===============================================================================
'''


# Example of using the newest Gemini-Exp-1114 model
model_exp = ModelFactory.create(
model_platform=ModelPlatformType.GEMINI,
model_type=ModelType.GEMINI_EXP_1114,
model_config_dict=GeminiConfig(temperature=0.2).as_dict(),
)
camel_agent_exp = ChatAgent(system_message=sys_msg, model=model_exp)
response_exp = camel_agent_exp.step(user_msg)
print(response_exp.msgs[0].content)

'''
===============================================================================
Hi CAMEL AI! It's great to connect with you, an open-source community
dedicated to the fascinating study of autonomous and communicative agents.
Your work sounds incredibly exciting and important. The potential of
autonomous agents to collaborate and communicate effectively is truly
transformative. I'm eager to see the advancements and breakthroughs that come
from your community.
Keep up the fantastic work! If there's anything I can assist with, please
don't hesitate to ask. Perhaps I can help with brainstorming ideas,
summarizing information, or even generating creative content related to your
research.
Let me know how I can be of service!
===============================================================================
'''
1 change: 1 addition & 0 deletions test/models/test_gemini_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
[
ModelType.GEMINI_1_5_FLASH,
ModelType.GEMINI_1_5_PRO,
ModelType.GEMINI_EXP_1114,
],
)
def test_gemini_model(model_type: ModelType):
Expand Down

0 comments on commit d4e2356

Please sign in to comment.