-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add gemini model families, enhance group chat selection for Gem…
- Loading branch information
Showing
7 changed files
with
82 additions
and
9 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
45 changes: 45 additions & 0 deletions
45
python/packages/autogen-agentchat/tests/test_group_chat_endpoint.py
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,45 @@ | ||
import os | ||
|
||
import pytest | ||
from autogen_agentchat.agents import AssistantAgent | ||
from autogen_agentchat.teams import SelectorGroupChat | ||
from autogen_agentchat.ui import Console | ||
from autogen_core.models import ModelFamily | ||
from autogen_ext.models.openai import OpenAIChatCompletionClient | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_selector_group_chat_gemini() -> None: | ||
try: | ||
api_key = os.environ["GEMINI_API_KEY"] | ||
except KeyError: | ||
pytest.skip("GEMINI_API_KEY not set in environment variables.") | ||
|
||
model_client = OpenAIChatCompletionClient( | ||
model="gemini-1.5-flash", | ||
base_url="https://generativelanguage.googleapis.com/v1beta/openai/", | ||
api_key=api_key, | ||
model_info={ | ||
"vision": True, | ||
"function_calling": True, | ||
"json_output": True, | ||
"family": ModelFamily.GEMINI_1_5_FLASH, | ||
}, | ||
) | ||
|
||
assistant = AssistantAgent( | ||
"assistant", | ||
description="A helpful assistant agent.", | ||
model_client=model_client, | ||
system_message="You are a helpful assistant.", | ||
) | ||
|
||
critic = AssistantAgent( | ||
"critic", | ||
description="A critic agent to provide feedback.", | ||
model_client=model_client, | ||
system_message="Provide feedback.", | ||
) | ||
|
||
team = SelectorGroupChat([assistant, critic], model_client=model_client, max_turns=2) | ||
await Console(team.run_stream(task="Draft a short email about organizing a holiday party for new year.")) |
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
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