To get started, create an account with Pinecone if you don’t have one already. There is a free tier. Once you have an account, get an API key from the API Keys section on the Pinecone dashboard.

Add the API Key to your environment variables.

PINECONE_API_KEY=<your api key>

Install Pinecone addon

npm install @llm-tools/embedjs-pinecone

Usage

import { RAGApplicationBuilder } from '@llm-tools/embedjs';

import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';

import { PineconeDb } from '@llm-tools/embedjs-pinecone';

import { WebLoader } from '@llm-tools/embedjs-loader-web';



// set OPENAI_API_KEY in your env

process.env.OPENAI_API_KEY = "sk-xxx";



const app = await new RAGApplicationBuilder()

.setEmbeddingModel(new OpenAiEmbeddings())

.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)

.setVectorDatabase(new PineconeDb({

    projectName: '<name>',

    namespace: '<name>',

    indexSpec: {

        pod: {

            podType: 'p1.x1',

            environment: 'us-east1-gcp',

        },

    },

}))

.build();





//add data source and start query it

await app.addLoader(new WebLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' }));

await app.query('Tell me about Elon Musk');

If you can't find specific feature or run into issues, please feel free to reach out through the following channels.

Was this page helpful?