From 2a1e324c7191ff1862920180c3e09b6d318af36a Mon Sep 17 00:00:00 2001 From: Faisal Ilaiwi Date: Tue, 1 Oct 2024 14:33:01 -0700 Subject: [PATCH] add support for o1 and o1-mini models --- autogen/agentchat/conversable_agent.py | 3 ++- autogen/oai/openai_utils.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index 3a21c0f7d0..11b6d3c705 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -79,6 +79,7 @@ class ConversableAgent(LLMAgent): description: Optional[str] = None, chat_messages: Optional[Dict[Agent, List[Dict]]] = None, silent: Optional[bool] = None, + role_for_system_message: Literal["system", "user"] = "system", ): """ Args: @@ -143,7 +144,7 @@ class ConversableAgent(LLMAgent): else: self._oai_messages = chat_messages - self._oai_system_message = [{"content": system_message, "role": "system"}] + self._oai_system_message = [{"content": system_message, "role": role_for_system_message}] self._description = description if description is not None else system_message self._is_termination_msg = ( is_termination_msg diff --git a/autogen/oai/openai_utils.py b/autogen/oai/openai_utils.py index 3844795c24..4bed6b1f87 100644 --- a/autogen/oai/openai_utils.py +++ b/autogen/oai/openai_utils.py @@ -25,6 +25,12 @@ NON_CACHE_KEY = [ DEFAULT_AZURE_API_VERSION = "2024-02-01" OAI_PRICE1K = { # https://openai.com/api/pricing/ + # o1-preview + "o1-preview": (0.015, 0.060), + "o1-preview-2024-09-12": (0.015, 0.060), + # o1-mini + "o1-mini": (0.003, 0.012), + "o1-mini-2024-09-12": (0.003, 0.012), # gpt-4o "gpt-4o": (0.005, 0.015), "gpt-4o-2024-05-13": (0.005, 0.015),