Skip to content

a minor patch to support gpt-5 #225

@chunhualiao

Description

@chunhualiao
diff --git a/openevolve/llm/openai.py b/openevolve/llm/openai.py
index d396dd1..77f04a8 100644
--- a/openevolve/llm/openai.py
+++ b/openevolve/llm/openai.py
@@ -66,8 +66,10 @@ class OpenAILLM(LLMInterface):
         formatted_messages.extend(messages)
 
         # Set up generation parameters
-        if self.api_base == "https://api.openai.com/v1" and str(self.model).lower().startswith("o"):
-            # For o-series models
+        model_lower = str(self.model).lower()
+        # Check if model is o-series or gpt-5, which require max_completion_tokens
+        if self.api_base == "https://api.openai.com/v1" and (model_lower.startswith("o") or model_lower.startswith("gpt-5")):
+            # For o-series models and gpt-5
             params = {
                 "model": self.model,
                 "messages": formatted_messages,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions