Skip to main content

Pinecone Vector Index

Pinecone is a vector database that provides vector similarity search (VSS) functionality.

Setup

You can get an API key from Pinecone. You also need to create a Pinecone index.

Pinecone Client

You need to install the Pinecone JS client and the ModelFusion Pinecone extension:

npm install @modelfusion/pinecone @pinecone-database/pinecone

Usage

Examples

Create a Vector Index

import { PineconeVectorIndex } from "@modelfusion/pinecone";
import { PineconeClient } from "@pinecone-database/pinecone";
import { zodSchema } from "modelfusion";

// Initialize the Pinecone index:
const client = new PineconeClient();
await client.init({
apiKey: PINECONE_API_KEY,
environment: PINECONE_ENVIRONMENT,
});
const index = client.Index(PINECONE_INDEX_NAME);

// Create a vector index:
const vectorIndex = new PineconeVectorIndex({
index,
schema: zodSchema(zodSchema),
});

Source Code

@modelfusion/pinecone