semantic-search-nextjs-pinecone-langchain-chatgpt
semantic-search-nextjs-pinecone-langchain-chatgpt copied to clipboard
Update syntax for pinecone related code
Pinecone no longer supports an envirorment parm on init. Also init langchain's OpenAI object with gpt-3.5-turbo as text-davinci-003 has been deprecated
Needed to refactor because Pinecone's console no longer gives you a PINECONE_ENVIRONMENT value as seen in the screenshot below and stated here in their docs:
"On the new Pinecone API, you no longer choose a single cloud environment for a project. Instead, you choose a cloud environment for each index in a project."
- https://docs.pinecone.io/docs/projects)
So this was no longer valid and need to be updated to 2.0.1:
const client = new Pinecone({
apiKey: process.env.PINECONE_API_KEY || '',
environment: process.env.PINECONE_ENVIRONMENT || ''
})