Closed dependabot[bot] closed 9 months ago
This has breaking changes in it - investigating the problems:
{
code: "unknown_error"
error: "unknown_error"
message: "GPT Failure: 'unknown_error', TypeError: Cannot read properties of null (reading 'askGPT')"
status: "TypeError: Cannot read properties of null (reading 'askGPT')"
}
Changes have been made in how OpenAI's client is configured: https://github.com/openai/openai-node/discussions/217
Updating our code to reflect these changes now
Summary of the required changes:
Note: import changes and no longer requiring Configuration()
constructor
// Old
import { Configuration, OpenAIApi } from "openai";
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
// New
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY // This is also the default, can be omitted
});
Note: difference in function call, as well as the response format no longer nesting inside .data
// Old
const chatCompletion = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [{role: "user", content: "Hello world"}],
});
console.log(chatCompletion.data.choices[0].message);
// New
const chatCompletion = await openai.chat.completions.create({
model: "gpt-3.5-turbo",
messages: [{"role": "user", "content": "Hello!"}],
});
console.log(chatCompletion.choices[0].message);
Removes axios. It's no longer used after updating ancestor dependency openai. These dependencies need to be updated together.
Removes
axios
Updates
openai
from 3.2.1 to 4.17.4Release notes
Sourced from openai's releases.
... (truncated)
Changelog
Sourced from openai's changelog.
... (truncated)
Commits
12de980
Merge pull request #483 from openai/release-please--branches--master--changes...b8441a7
release: 4.17.43013e8c
chore(internal): update jest config (#482)d2d0ce5
release: 4.17.3d0e2c77
ci: fix deno version bump (#480)78ec255
Merge pull request #479 from openai/release-please--branches--master--changes...488d731
release: 4.17.269913f3
chore(internal): bump deno version number (#478)03d1662
Merge pull request #475 from openai/release-please--branches--master--changes...0532117
release: 4.17.1Maintainer changes
This version was pushed to npm by dschnurr-openai, a new releaser for openai since your current version.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show