From 07f3933f6da310d0b847ed727a0ab5a8cb5aeea3 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Thu, 19 Dec 2024 23:00:47 +0700 Subject: [PATCH 1/4] Add support OpenAI model o1 snapshot version o1-2024-12-17 --- pr_agent/algo/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index 20e463c3..4f9ec547 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -24,6 +24,7 @@ MAX_TOKENS = { 'o1-mini-2024-09-12': 128000, # 128K, but may be limited by config.max_model_tokens 'o1-preview': 128000, # 128K, but may be limited by config.max_model_tokens 'o1-preview-2024-09-12': 128000, # 128K, but may be limited by config.max_model_tokens + 'o1-2024-12-17': 128000, # 128K, but may be limited by config.max_model_tokens 'claude-instant-1': 100000, 'claude-2': 100000, 'command-nightly': 4096, From eaaaf6a6a2e48be99a5ff1d0888276b4bf1b9926 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Thu, 19 Dec 2024 23:11:45 +0700 Subject: [PATCH 2/4] Fix context windows token for model o1-2024-12-17 --- pr_agent/algo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index 4f9ec547..b25ed208 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -24,7 +24,7 @@ MAX_TOKENS = { 'o1-mini-2024-09-12': 128000, # 128K, but may be limited by config.max_model_tokens 'o1-preview': 128000, # 128K, but may be limited by config.max_model_tokens 'o1-preview-2024-09-12': 128000, # 128K, but may be limited by config.max_model_tokens - 'o1-2024-12-17': 128000, # 128K, but may be limited by config.max_model_tokens + 'o1-2024-12-17': 204800, # 200K, but may be limited by config.max_model_tokens 'claude-instant-1': 100000, 'claude-2': 100000, 'command-nightly': 4096, From 8d7825233a1094bdafd87f1e2d7f63035fa43c6a Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 22 Dec 2024 10:33:26 +0700 Subject: [PATCH 3/4] Supported model gpt-o1 --- pr_agent/algo/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index b25ed208..cf09f4ad 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -25,6 +25,7 @@ MAX_TOKENS = { 'o1-preview': 128000, # 128K, but may be limited by config.max_model_tokens 'o1-preview-2024-09-12': 128000, # 128K, but may be limited by config.max_model_tokens 'o1-2024-12-17': 204800, # 200K, but may be limited by config.max_model_tokens + 'o1': 204800, # 200K, but may be limited by config.max_model_tokens 'claude-instant-1': 100000, 'claude-2': 100000, 'command-nightly': 4096, From 23678c1d4d091acd354b78e59029f6fc2fcbedf9 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 22 Dec 2024 10:36:59 +0700 Subject: [PATCH 4/4] Update O1_MODEL_PREFIX to o1 based on new models released --- pr_agent/algo/ai_handlers/litellm_ai_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index c53c1ec3..c8a752f8 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -193,8 +193,8 @@ class LiteLLMAIHandler(BaseAiHandler): messages[1]["content"] = [{"type": "text", "text": messages[1]["content"]}, {"type": "image_url", "image_url": {"url": img_path}}] - # Currently O1 does not support separate system and user prompts - O1_MODEL_PREFIX = 'o1-' + # Currently, model OpenAI o1 series does not support a separate system and user prompts + O1_MODEL_PREFIX = 'o1' model_type = model.split('/')[-1] if '/' in model else model if model_type.startswith(O1_MODEL_PREFIX): user = f"{system}\n\n\n{user}"