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

Help! can not run the default example from npm #1007

Open
1 task done
cu8code opened this issue Aug 22, 2024 · 1 comment
Open
1 task done

Help! can not run the default example from npm #1007

cu8code opened this issue Aug 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cu8code
Copy link

cu8code commented Aug 22, 2024

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

i tried to run the default example after installing the package and i get this error which is hard to belive
image

my package.json

{
  "dependencies": {
    "@types/clipboardy": "^2.0.1",
    "@types/cors": "^2.8.17",
    "@types/fluent-ffmpeg": "^2.1.25",
    "cors": "^2.8.5",
    "fluent-ffmpeg": "^2.1.3",
    "form-data": "^4.0.0",
    "keydb": "^0.1.10",
    "openai": "^4.56.0"
  },
  "name": "blogforge",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "dev:f": "cd frontend && next dev",
    "dev:s": "cd server && ts-node src/index.ts"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "workspaces": [
    "./frontend",
    "./share",
    "./server"
  ]
}

To Reproduce

install the openai package in your project

Code snippets

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY']!, // This is the default and can be omitted
});

async function main() {
  const chatCompletion = await client.chat.completions.create({
    messages: [{ role: 'user', content: 'Say this is a test' }],
    model: 'gpt-3.5-turbo',
  });
}

main();

OS

linux fedora

Node version

v20.12.2

Library version

^4.56.0

@cu8code cu8code added the bug Something isn't working label Aug 22, 2024
@RobertCraigie
Copy link
Collaborator

Hey @cu8code is this still happening for you?

I'm also curious if this error was just happening in your editor or if it didn't work when running the code as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants