A programming framework for agentic AI
Add gpt-4o-mini, update examples (#253)
Eric Zhu176932ef9cab
diff --git a/python/docs/src/core-concepts/ai-agents.md b/python/docs/src/core-concepts/ai-agents.mdindex 006ea850c..2177fe853 100644--- a/python/docs/src/core-concepts/ai-agents.md+++ b/python/docs/src/core-concepts/ai-agents.md@@ -71,7 +71,7 @@ async def main():runtime = SingleThreadedAgentRuntime()agent = await runtime.register_and_get("simple-agent",- lambda: SimpleAgent(OpenAIChatCompletionClient(model="gpt-3.5-turbo", api_key="YOUR_API_KEY")),+ lambda: SimpleAgent(OpenAIChatCompletionClient(model="gpt-4o-mini", api_key="YOUR_API_KEY")),# Leave out the api_key field if you have the API key in the environment variable OPENAI_API_KEY)# Start the runtime processing messages.@@ -257,7 +257,7 @@ async def main() -> None:agent = await runtime.register_and_get("tool-agent",lambda: ToolAgent(- OpenAIChatCompletionClient(model="gpt-3.5-turbo", api_key="YOUR_API_KEY"),+ OpenAIChatCompletionClient(model="gpt-4o-mini", api_key="YOUR_API_KEY"),tools=[FunctionTool(get_stock_price, description="Get the stock price."),],diff --git a/python/samples/core/one_agent_direct.py b/python/samples/core/one_agent_direct.pyindex ec8b298ee..b7b7b9a56 100644--- a/python/samples/core/one_agent_direct.py+++ b/python/samples/core/one_agent_direct.py@@ -47,7 +47,7 @@ async def main() -> None:runtime = SingleThreadedAgentRuntime()agent = await runtime.register_and_get("chat_agent",- lambda: ChatCompletionAgent("Chat agent", get_chat_completion_client_from_envs(model="gpt-3.5-turbo")),+ lambda: ChatCompletionAgent("Chat agent", get_chat_completion_client_from_envs(model="gpt-4o-mini")),)run_context = runtime.start()diff --git a/python/samples/core/two_agents_pub_sub.py b/python/samples/core/two_agents_pub_sub.pyindex ffaba2c17..e33db7d3d 100644--- a/python/samples/core/two_agents_pub_sub.py+++ b/python/samples/core/two_agents_pub_sub.py@@ -81,7 +81,7 @@ async def main() -> None:"Jack",lambda: ChatCompletionAgent(description="Jack a comedian",- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),system_messages=[SystemMessage("You are a comedian likes to make jokes. " "When you are done talking, say 'TERMINATE'.")],@@ -92,7 +92,7 @@ async def main() -> None:"Cathy",lambda: ChatCompletionAgent(description="Cathy a poet",- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),system_messages=[SystemMessage("You are a poet likes to write poems. " "When you are done talking, say 'TERMINATE'.")],diff --git a/python/samples/patterns/coder_reviewer.py b/python/samples/patterns/coder_reviewer.pyindex acddc5f38..77be82f64 100644--- a/python/samples/patterns/coder_reviewer.py+++ b/python/samples/patterns/coder_reviewer.py@@ -255,14 +255,14 @@ async def main() -> None:"ReviewerAgent",lambda: ReviewerAgent(description="Code Reviewer",- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),),)await runtime.register("CoderAgent",lambda: CoderAgent(description="Coder",- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),),)run_context = runtime.start()diff --git a/python/samples/patterns/group_chat.py b/python/samples/patterns/group_chat.pyindex 710a7c6ed..7f4962d11 100644--- a/python/samples/patterns/group_chat.py+++ b/python/samples/patterns/group_chat.py@@ -118,7 +118,7 @@ async def main() -> None:lambda: GroupChatParticipant(description="A data scientist",system_messages=[SystemMessage("You are a data scientist.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),),)agent2 = await runtime.register_and_get(@@ -126,7 +126,7 @@ async def main() -> None:lambda: GroupChatParticipant(description="An engineer",system_messages=[SystemMessage("You are an engineer.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),),)agent3 = await runtime.register_and_get(@@ -134,7 +134,7 @@ async def main() -> None:lambda: GroupChatParticipant(description="An artist",system_messages=[SystemMessage("You are an artist.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),),)diff --git a/python/samples/patterns/mixture_of_agents.py b/python/samples/patterns/mixture_of_agents.pyindex 4ef5e3e4a..4b1f5c073 100644--- a/python/samples/patterns/mixture_of_agents.py+++ b/python/samples/patterns/mixture_of_agents.py@@ -117,7 +117,7 @@ async def main() -> None:lambda: ReferenceAgent(description="Reference Agent 1",system_messages=[SystemMessage("You are a helpful assistant that can answer questions.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo", temperature=0.1),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini", temperature=0.1),),)await runtime.register(@@ -125,7 +125,7 @@ async def main() -> None:lambda: ReferenceAgent(description="Reference Agent 2",system_messages=[SystemMessage("You are a helpful assistant that can answer questions.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo", temperature=0.5),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini", temperature=0.5),),)await runtime.register(@@ -133,7 +133,7 @@ async def main() -> None:lambda: ReferenceAgent(description="Reference Agent 3",system_messages=[SystemMessage("You are a helpful assistant that can answer questions.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo", temperature=1.0),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini", temperature=1.0),),)await runtime.register(@@ -145,7 +145,7 @@ async def main() -> None:"...synthesize these responses into a single, high-quality response... Responses from models:")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),num_references=3,),)diff --git a/python/samples/patterns/multi_agent_debate.py b/python/samples/patterns/multi_agent_debate.pyindex 57d3baed7..e99805bb7 100644--- a/python/samples/patterns/multi_agent_debate.py+++ b/python/samples/patterns/multi_agent_debate.py@@ -214,7 +214,7 @@ async def main(question: str) -> None:await runtime.register("MathSolver1",lambda: MathSolver(- get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ get_chat_completion_client_from_envs(model="gpt-4o-mini"),neighbor_names=["MathSolver2", "MathSolver4"],max_round=3,),@@ -222,7 +222,7 @@ async def main(question: str) -> None:await runtime.register("MathSolver2",lambda: MathSolver(- get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ get_chat_completion_client_from_envs(model="gpt-4o-mini"),neighbor_names=["MathSolver1", "MathSolver3"],max_round=3,),@@ -230,7 +230,7 @@ async def main(question: str) -> None:await runtime.register("MathSolver3",lambda: MathSolver(- get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ get_chat_completion_client_from_envs(model="gpt-4o-mini"),neighbor_names=["MathSolver2", "MathSolver4"],max_round=3,),@@ -238,7 +238,7 @@ async def main(question: str) -> None:await runtime.register("MathSolver4",lambda: MathSolver(- get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ get_chat_completion_client_from_envs(model="gpt-4o-mini"),neighbor_names=["MathSolver1", "MathSolver3"],max_round=3,),diff --git a/python/samples/tool-use/coding_one_agent_direct.py b/python/samples/tool-use/coding_one_agent_direct.pyindex 9facda9fc..3b029d354 100644--- a/python/samples/tool-use/coding_one_agent_direct.py+++ b/python/samples/tool-use/coding_one_agent_direct.py@@ -134,7 +134,7 @@ async def main() -> None:lambda: ToolEnabledAgent(description="Tool Use Agent",system_messages=[SystemMessage("You are a helpful AI Assistant. Use your tools to solve problems.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),tools=tools,),)diff --git a/python/samples/tool-use/coding_one_agent_direct_intercept.py b/python/samples/tool-use/coding_one_agent_direct_intercept.pyindex a7bdc7a67..be26b96c1 100644--- a/python/samples/tool-use/coding_one_agent_direct_intercept.py+++ b/python/samples/tool-use/coding_one_agent_direct_intercept.py@@ -52,7 +52,7 @@ async def main() -> None:lambda: ToolEnabledAgent(description="Tool Use Agent",system_messages=[SystemMessage("You are a helpful AI Assistant. Use your tools to solve problems.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),tools=tools,),)diff --git a/python/samples/tool-use/coding_two_agent_pub_sub.py b/python/samples/tool-use/coding_two_agent_pub_sub.pyindex c9ba45cb0..61d4719aa 100644--- a/python/samples/tool-use/coding_two_agent_pub_sub.py+++ b/python/samples/tool-use/coding_two_agent_pub_sub.py@@ -197,7 +197,7 @@ async def main() -> None:lambda: ToolUseAgent(description="Tool Use Agent",system_messages=[SystemMessage("You are a helpful AI Assistant. Use your tools to solve problems.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),tools=tools,),)diff --git a/python/samples/tool-use/custom_function_tool_one_agent_direct.py b/python/samples/tool-use/custom_function_tool_one_agent_direct.pyindex ce0af1206..156bffa21 100644--- a/python/samples/tool-use/custom_function_tool_one_agent_direct.py+++ b/python/samples/tool-use/custom_function_tool_one_agent_direct.py@@ -37,7 +37,7 @@ async def main() -> None:lambda: ToolEnabledAgent(description="Tool Use Agent",system_messages=[SystemMessage("You are a helpful AI Assistant. Use your tools to solve problems.")],- model_client=get_chat_completion_client_from_envs(model="gpt-3.5-turbo"),+ model_client=get_chat_completion_client_from_envs(model="gpt-4o-mini"),tools=[# Define a tool that gets the stock price.FunctionTool(diff --git a/python/src/agnext/components/models/_model_info.py b/python/src/agnext/components/models/_model_info.pyindex 06a28d6ad..583765a52 100644--- a/python/src/agnext/components/models/_model_info.py+++ b/python/src/agnext/components/models/_model_info.py@@ -6,6 +6,7 @@ from ._model_client import ModelCapabilities# This is a moving target, so correctness is checked by the model value returned by openai against expected values at runtime``_MODEL_POINTERS = {"gpt-4o": "gpt-4o-2024-05-13",+ "gpt-4o-mini": "gpt-4o-mini-2024-07-18","gpt-4-turbo": "gpt-4-turbo-2024-04-09","gpt-4-turbo-preview": "gpt-4-0125-preview","gpt-4": "gpt-4-0613",@@ -20,6 +21,11 @@ _MODEL_CAPABILITIES: Dict[str, ModelCapabilities] = {"function_calling": True,"json_output": True,},+ "gpt-4o-mini-2024-07-18": {+ "vision": True,+ "function_calling": True,+ "json_output": True,+ },"gpt-4-turbo-2024-04-09": {"vision": True,"function_calling": True,@@ -79,6 +85,7 @@ _MODEL_CAPABILITIES: Dict[str, ModelCapabilities] = {_MODEL_TOKEN_LIMITS: Dict[str, int] = {"gpt-4o-2024-05-13": 128000,+ "gpt-4o-mini-2024-07-18": 128000,"gpt-4-turbo-2024-04-09": 128000,"gpt-4-0125-preview": 128000,"gpt-4-1106-preview": 128000,