Skip to main content

Pinecone

Pinecone is a vector database that simplifies the process of creating high-performance vector search applications

Official Websitehttps://www.pinecone.io
TagsDatabaseVector
Network Connection needs

This integration needs network access to the server where the service is running.

See the Network access page for details about how to achieve that.

Credential configuration

To configure this credential, you need the environmment, and the api key to connect to your project.

Here is an example of a filled credential configuration form in YepCode:

Pinecone Snippets available in Editor

note

The title is the triggering text for YepCode to autocomplete the script.

Integration

New integration from credential
const pineconeClient = yepcode.integration.pinecone('credential-slug')
New integration from plain authentication data
const { Pinecone } = require('@pinecone-database/pinecone');

const pineconeClient = new Pinecone({
apiKey: 'YOUR_API_KEY',
});

Create Index

Creates an index
await pineconeClient.createIndex({
name: "example-index",
dimension: 1024,
});

List Indexes

Lists all indexes in your project
const indexesList = await pineconeClient.listIndexes();

Construct an index Object

Construct an index objet with an existing index name
const index = pineconeClient.index('example-index');
// Now perform index operations
await index.fetch(['1']);

Describe Index

Logs information about an index in your project
const indexDescription = await pineconeClient.describeIndex({
indexName: "example-index",
});

Delete Index

Deletes an index
await pineconeClient.deleteIndex({
indexName: "example-index",
});

Upsert Vectors

Upserts vector to an index
const index = pineconeClient.index("example-index");
await index.upsert([
{
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
metadata: {
genre: "drama",
},
},
{
id: "vec2",
values: [0.2, 0.3, 0.4, 0.5],
metadata: {
genre: "action",
},
},
]);

Query and Index

Queries an index filtering
await pineconeClient.configureIndex({
indexName: "example-index",
patchRequest: {
replicas: 2,
podType: "p2",
},
});

Update Vectors

Updates a vector
const index = pineconeClient.index("example-index");
const updateResponse = await index.update({
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
setMetadata: { genre: "drama" },
namespace: "example-namespace",
});

Delete Vectors

Deletes a vector
const index = pineconeClient.index("example-index");
await index.deleteOne("vec1")
await index.deleteMany(["vec1", "vec2"]);
await index.deleteAll()

Create Collection

Creates a collection from an index
const createCollectionRequest = {
name: "example-collection",
source: "example-index",
};

await pineconeClient.createCollection({
createCollectionRequest,
});

List Collections

List the collections in your current project
const collectionsList = await pineconeClient.listCollections();

Describe Collection

Returns a description of one collection
const collectionDescription = await pineconeClient.describeCollection("example-collection");

Delete Collection

Deletes a collection
await pineconeClient.deleteCollection("example-collection");