Hi, I’m adding a openai function to an existing project. I’m using VSC, yarn, python, node.js. I’ve imported openai to the project and I can see it in my dependencies. Just to test I’ve added a user prompt which should then call openai and display the response.
I’m using import * as openai from ‘openai’
but it cannot find openai.complete in the below code (it’s not a code issue but just for example)
Property ‘complete’ does not exist on type ‘typeof import(“REDACTED/node_modules/openai/dist/index”)’
ChatGPT unhelpfully advices me to upgrade to the latest version of openai, but I already am. Scratching my head now, although I’m sure it’s something to do with my environment, I just dont know where to look.
You have no idea @matthew.rogers how much time we “experienced coders” waste here answering ChatGPT coded nonsense questions.
It’s the “new form of spam” where folks to go ChatGPT, a language generating tool and waste so much time debugging “ChatGPT nonsense” when they could go to the expertly written and up-to-data API docs and have working code, as you just discovered @matthew.rogers
ChatGPT is “OK” for writing draft code which is not based on changing, updating libraries, For example, if you ask ChatGPT to write a method to sort an array of hashes based on a hash key in Python, Ruby, JS, etc. you will probably get a good draft of a code method. That is because that code is “mature” and not based on a lib which changes.
In this case, ChatGPT is working with deprecated code data samples from mid 2021 and so it’s writing depreciated, unusable code for you.