How to create a pinecone client, it's giving error

64 Views Asked by At

The is present in the pinecone.ts

import { PineconeClient } from '@pinecone-database/pinecone'

export const getPineconeClient = async () => {
  const client = new PineconeClient()

  await client.init({
    apiKey: process.env.PINECONE_API_KEY!,
    environment: 'gcp-starter',
  })

  return client
}

core.ts (where I want to use Pinecone Client)

const pinecone = await PineconeClient() // this also giving error 
const pineconeIndex = pinecone.Index('name')
1

There are 1 best solutions below

0
Mit Shah On

Please check your @pinecone-database/pinecone library version, because from v1.1.0 they removed PineconeClient.

following is the updated way of creating pincone client,

import { Pinecone } from '@pinecone-database/pinecone';

const pc = new Pinecone({
  apiKey: 'your_api_key',
});

You can refer following link for the same:

https://docs.pinecone.io/legacy/getting-started/quickstart

Please try this solution, if you still find an error let me know.