일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- express.js
- built in object
- Redux
- CSS
- bitcoin
- HTML
- SSR
- Ethereum
- node.js
- useState
- CLASS
- concept
- tailwindcss
- JavaScript
- Interface
- evm
- blockchain
- REACT
- API
- error
- Props
- web
- 기준
- nextJS
- middleware
- hardhat
- typeScript
- solidity
- graphQL
- 삶
- Today
- Total
ReasonJun
OpenAI V4 : Module '"openai"' has no exported member 'Configuration'. Did you mean to use 'import Configuration from "openai"' instead? 본문
OpenAI V4 : Module '"openai"' has no exported member 'Configuration'. Did you mean to use 'import Configuration from "openai"' instead?
ReasonJun 2023. 9. 15. 12:47
OpenAI NodeJS SDK v4 was released on August 16, 2023, and is a complete rewrite of the SDK.
If you install V4 and apply the grammar from V3, you'll get the error above.
https://platform.openai.com/docs/api-reference/chat
OpenAI Platform
Explore developer resources, tutorials, API docs, and dynamic examples to get the most out of OpenAI's platform.
platform.openai.com
The above is the official Openai api documentation, but there is no update as of (2023.09.15) on how to use 4.0.0. (Am I missing something?)
Anyway, I googled it and here's what I found.
// 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,
});
OpenAI API error: "Module 'openai' has no exported member 'Configuration'"
I'm trying to do an API call to the GPT-3.5 API, but anything imported from OpenAI is giving me a has no exported member error. import { Configuration, OpenAIApi } from "openai"; import {...
stackoverflow.com
It is said to have been upgraded from version 3 with the following changes.
What's new
- Streaming support for completions and chat completions!
- Automatic retries (defaults to 2)
- Improved typescript types for responses & errors
- Support for ESM, cloudflare workers, vercel edge functions, deno
- Improved latency through reusing TCP connections
- Simpler initialization logic
https://github.com/openai/openai-node/discussions/182
v4.0.0 Beta · openai/openai-node · Discussion #182
Important OpenAI v4 has launched and is no longer in beta! Give it a spin with npm install openai and check out the migration guide We're working on a new major version of our SDK and are excited t...
github.com
Migration Guide
https://github.com/openai/openai-node/discussions/217
v3 to v4 Migration Guide · openai/openai-node · Discussion #217
v4 is a complete rewrite of the SDK. To see what's new, see the release notes. Installation First, update your package.json to specify v4: "openai": "^4.0.0" and run npm install or equivalent to do...
github.com