From ea0e6bb5b6c93200f0ddc1e51e8dea4085f1dbda Mon Sep 17 00:00:00 2001 From: Mark Eaton Date: Wed, 17 Sep 2025 15:44:10 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20update=20call=5Fo3=20to=20use=20chat.com?= =?UTF-8?q?pletions=20for=20OpenAI=20API=20=E2=89=A5=201.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: aider (o3) --- scripts/batch_o3_prompts.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/batch_o3_prompts.py b/scripts/batch_o3_prompts.py index 044ec19..df6ad8b 100644 --- a/scripts/batch_o3_prompts.py +++ b/scripts/batch_o3_prompts.py @@ -46,13 +46,19 @@ def write_output(path: Path, record: Dict[str, Any]) -> None: def call_o3(prompt: str) -> str: - response = client.completions.create( + """ + Send the prompt to the chat-completions endpoint (OpenAI ≥ 1.0.0). + + The prompt is wrapped in a single user message so the new API remains + compatible with the existing template-based workflow. + """ + response = client.chat.completions.create( model=MODEL, - prompt=prompt, + messages=[{"role": "user", "content": prompt}], max_tokens=1024, temperature=0.7, ) - return response.choices[0].text.strip() + return response.choices[0].message.content.strip() def main(argv: list[str] | None = None) -> None: