Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'openai' does not provide an export named 'Configuration' #41

Open
VishantJadhav opened this issue Aug 20, 2023 · 5 comments
Open

'openai' does not provide an export named 'Configuration' #41

VishantJadhav opened this issue Aug 20, 2023 · 5 comments

Comments

@VishantJadhav
Copy link

VishantJadhav commented Aug 20, 2023

I am getting this error in terminal whenever i try to run my server, and i am stuck there. Can anybody provide some solution?

Screenshot 2023-08-20 183437

@kirab-21
Copy link

you can import the whole module instead . It worked for me

@harshit4317
Copy link

I am getting this error in terminal whenever i try to run my server, and i am stuck there. Can anybody provide some solution?

Screenshot 2023-08-20 183437

// 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
});

@VishantJadhav
Copy link
Author

Thanks @harshit4317

@r0ab
Copy link

r0ab commented Oct 5, 2023

use this instead :
import OpenAI from 'openai';

fixes#41

@karthikprasads
Copy link

use
import OpenAI from 'openai';
import Configuration from 'openai';

works 100%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants