fix: update call_o3 to use chat.completions for OpenAI API ≥ 1.0.0
Co-authored-by: aider (o3) <aider@aider.chat>
This commit is contained in:
@@ -46,13 +46,19 @@ def write_output(path: Path, record: Dict[str, Any]) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def call_o3(prompt: str) -> str:
|
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,
|
model=MODEL,
|
||||||
prompt=prompt,
|
messages=[{"role": "user", "content": prompt}],
|
||||||
max_tokens=1024,
|
max_tokens=1024,
|
||||||
temperature=0.7,
|
temperature=0.7,
|
||||||
)
|
)
|
||||||
return response.choices[0].text.strip()
|
return response.choices[0].message.content.strip()
|
||||||
|
|
||||||
|
|
||||||
def main(argv: list[str] | None = None) -> None:
|
def main(argv: list[str] | None = None) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user