A programming framework for agentic AI
feat: add o3 to model info; update chess example (#5311)
Eric Zhucd9dca47407c
diff --git a/python/packages/autogen-core/src/autogen_core/models/_model_client.py b/python/packages/autogen-core/src/autogen_core/models/_model_client.pyindex 62c26c51a..d76b7191b 100644--- a/python/packages/autogen-core/src/autogen_core/models/_model_client.py+++ b/python/packages/autogen-core/src/autogen_core/models/_model_client.py@@ -20,12 +20,13 @@ class ModelFamily:GPT_4O = "gpt-4o"O1 = "o1"+ O3 = "o3"GPT_4 = "gpt-4"GPT_35 = "gpt-35"R1 = "r1"UNKNOWN = "unknown"- ANY: TypeAlias = Literal["gpt-4o", "o1", "gpt-4", "gpt-35", "r1", "unknown"]+ ANY: TypeAlias = Literal["gpt-4o", "o1", "o3", "gpt-4", "gpt-35", "r1", "unknown"]def __new__(cls, *args: Any, **kwargs: Any) -> ModelFamily:raise TypeError(f"{cls.__name__} is a namespace class and cannot be instantiated.")diff --git a/python/packages/autogen-ext/src/autogen_ext/models/openai/_model_info.py b/python/packages/autogen-ext/src/autogen_ext/models/openai/_model_info.pyindex c69ed87d1..316725f0b 100644--- a/python/packages/autogen-ext/src/autogen_ext/models/openai/_model_info.py+++ b/python/packages/autogen-ext/src/autogen_ext/models/openai/_model_info.py@@ -5,6 +5,7 @@ from autogen_core.models import ModelFamily, ModelInfo# Based on: https://platform.openai.com/docs/models/continuous-model-upgrades# This is a moving target, so correctness is checked by the model value returned by openai against expected values at runtime``_MODEL_POINTERS = {+ "o3-mini": "o3-mini-2025-01-31","o1": "o1-2024-12-17","o1-preview": "o1-preview-2024-09-12","o1-mini": "o1-mini-2024-09-12",@@ -19,6 +20,12 @@ _MODEL_POINTERS = {}_MODEL_INFO: Dict[str, ModelInfo] = {+ "o3-mini-2025-01-31": {+ "vision": False,+ "function_calling": True,+ "json_output": True,+ "family": ModelFamily.O3,+ },"o1-2024-12-17": {"vision": False,"function_calling": False,diff --git a/python/samples/agentchat_chess_game/.gitignore b/python/samples/agentchat_chess_game/.gitignoreindex 189b1a838..74565a19d 100644--- a/python/samples/agentchat_chess_game/.gitignore+++ b/python/samples/agentchat_chess_game/.gitignore@@ -1 +1,2 @@model_config.yml+model_config.yaml\ No newline at end of filediff --git a/python/samples/agentchat_chess_game/README.md b/python/samples/agentchat_chess_game/README.mdindex 00251bcfd..7dee8a5cf 100644--- a/python/samples/agentchat_chess_game/README.md+++ b/python/samples/agentchat_chess_game/README.md@@ -27,7 +27,16 @@ For example, to use `gpt-4o` model from OpenAI, you can use the following configprovider: autogen_ext.models.openai.OpenAIChatCompletionClientconfig:model: gpt-4o- api_key: REPLACE_WITH_YOUR_API_KEY+ api_key: replace with your API key or skip it if you have environment variable OPENAI_API_KEY set+```++To use `o3-mini-2025-01-31` model from OpenAI, you can use the following configuration:++```yaml+provider: autogen_ext.models.openai.OpenAIChatCompletionClient+config:+ model: o3-mini-2025-01-31+ api_key: replace with your API key or skip it if you have environment variable OPENAI_API_KEY set```To use a locally hosted DeepSeek-R1:8b model using Ollama throught its compatibility endpoint,diff --git a/python/samples/agentchat_chess_game/main.py b/python/samples/agentchat_chess_game/main.pyindex 51870a913..e9b2f314f 100644--- a/python/samples/agentchat_chess_game/main.py+++ b/python/samples/agentchat_chess_game/main.py@@ -12,7 +12,7 @@ from autogen_core.models import ChatCompletionClientdef create_ai_player() -> AssistantAgent:# Load the model client from config.- with open("model_config.yml", "r") as f:+ with open("model_config.yaml", "r") as f:model_config = yaml.safe_load(f)model_client = ChatCompletionClient.load_component(model_config)# Create an agent that can use the model client.