diff --git a/scripts/batch_o3_prompts.py b/scripts/batch_o3_prompts.py index c34a75d..044ec19 100644 --- a/scripts/batch_o3_prompts.py +++ b/scripts/batch_o3_prompts.py @@ -20,10 +20,13 @@ from pathlib import Path from typing import Any, Dict from dotenv import load_dotenv -import openai +from openai import OpenAI MODEL = "o3" +# instantiate the v1 OpenAI client (api_key read from environment/.env) +client = OpenAI() + def load_template(path: Path) -> str: with path.open(encoding="utf-8") as fh: @@ -43,7 +46,7 @@ def write_output(path: Path, record: Dict[str, Any]) -> None: def call_o3(prompt: str) -> str: - response = openai.Completion.create( + response = client.completions.create( model=MODEL, prompt=prompt, max_tokens=1024,