Skip to content

Commit

Permalink
api change openai
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathijn Elhorst committed Dec 21, 2023
1 parent 8478803 commit 93b22e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ class OpenAIClient extends AIClient {
if (apiResponse.choices.length === 0) {
throw new Error("No response from OpenAI");
}
if ((apiResponse.choices[0] as any).finish_details.type !== "stop") {
if ((apiResponse.choices[0] as any).finish_reason !== "stop") {
throw new Error(
`OpenAI did not finish but gave as failure reason: ${
(apiResponse.choices[0] as any).finish_details.type
(apiResponse.choices[0] as any).finish_reason
}\nThe complete response was: ${JSON.stringify(apiResponse)}`,
);
}
Expand Down

0 comments on commit 93b22e0

Please sign in to comment.