Pinecone Integration avatar
Pinecone Integration
Try for free

No credit card required

View all Actors
Pinecone Integration

Pinecone Integration

Try for free

No credit card required

This integration transfers data from Apify Actors to a Pinecone and is a good starting point for a question-answering, search, or RAG use case.

The Apify Pinecone integration transfers selected data from Apify Actors to a Pinecone database. It processes the data, optionally splits it into chunks, computes embeddings, and saves them to Pinecone.

This integration supports incremental updates, updating only the data that has changed. This approach reduces unnecessary embedding computation and storage operations, making it suitable for search and retrieval augmented generation (RAG) use cases.

馃挕 Note: This Actor is meant to be used together with other Actors' integration sections. For instance, if you are using the Website Content Crawler, you can activate Pinecone integration to save web data as vectors to Pinecone.

For more information how to leverage vector stores in Apify platform, see Pinecone integration and detailed blog post what Pinecone is and why you should use it with your LLMs.

How does it work?

Apify Pinecone integration computes text embeddings and store them in Pinecone. It uses LangChain to compute embeddings and interact with Pinecone.

  1. Retrieve a dataset as output from an Actor
  2. [Optional] Split text data into chunks using langchain's RecursiveCharacterTextSplitter (enable/disable using performChunking and specify chunkSize, chunkOverlap)
  3. [Optional] Update only changed data in Pinecone (enable/disable using enableDeltaUpdates)
  4. Compute embeddings, e.g. using OpenAI or Cohere (specify embeddings and embeddingsConfig)
  5. Save data into the database

Before you start

To utilize this integration, ensure you have:

  • Created or existing Pinecone database. You need to know indexName and apiKey.
  • An account to compute embeddings using one of the providers, e.g., OpenAI or Cohere.


For detailed input information refer to input schema.

The configuration consists of three parts: Pinecone, embeddings provider, and data.

Ensure that the vector size of your embeddings aligns with the configuration of your Pinecone index. For instance, if you're using the text-embedding-3-small model from OpenAI, it generates vectors of size 1536. This means your Pinecone index should also be configured to accommodate vectors of the same size, 1536 in this case.

Database: Pinecone

2  "pineconeApiKey": "YOUR-PINECONE-API-KEY",
3  "pineconeIndexName": "apify-pinecone"

Embeddings provider: OpenAI

2  "embeddingsProvider": "OpenAIEmbeddings",
3  "embeddingsApiKey": "YOUR-OPENAI-API-KEY",
4  "embeddingsConfig": {"model":  "text-embedding-3-large"}

Save data from Website Content Crawler to Pinecone

Data is transferred in the form of a dataset from Website Content Crawler, which provides a dataset with the following output fields (truncated for brevity):

2  "url": "",
3  "text": "Apify is a platform that enables developers to build, run, and share automation tasks.",
4  "metadata": {"title": "Apify"}

This dataset is then processed by the Pinecone integration. In the integration settings you need to specify which fields you want to save to Pinecone, e.g., ["text"] and which of them should be used as metadata, e.g., {"title": "metadata.title"}. Without any other configuration, the data is saved to Pinecone as is.

2  "datasetFields": ["text"],
3  "metadataDatasetFields": {"title": "metadata.title"}

Create chunks from Website Content Crawler data and save them to the database

Assume that the text data from the Website Content Crawler is too long to compute embeddings. Therefore, we need to divide the data into smaller pieces called chunks. We can leverage LangChain's RecursiveCharacterTextSplitter to split the text into chunks and save them into a database. The parameters chunkSize and chunkOverlap are important. The settings depend on your use case where a proper chunking helps optimize retrieval and ensures accurate responses.

2  "datasetFields": ["text"],
3  "metadataDatasetFields": {"title": "metadata.title"},
4  "performChunking": true,
5  "chunkSize": 1000,
6  "chunkOverlap": 0

Incrementally update database from the Website Content Crawler

To incrementally update data from the Website Content Crawler to Pinecone, configure the integration to update only the changed or new data. This is controlled by the enableDeltaUpdates setting. This way, the integration minimizes unnecessary updates and ensures that only new or modified data is processed.

A checksum is computed for each dataset item (together with all metadata) and stored in the database alongside the vectors. When the data is re-crawled, the checksum is recomputed and compared with the stored checksum. If the checksum is different, the old data (including vectors) is deleted and new data is saved. Otherwise, only the last_seen_at metadata field is updated to indicate when the data was last seen.

Provide unique identifier for each dataset item

To incrementally update the data, you need to be able to uniquely identify each dataset item. The variable deltaUpdatesPrimaryDatasetFields specifies which fields are used to uniquely identify each dataset item and helps track content changes across different crawls. For instance, when working with the Website Content Crawler, you can use the URL as a unique identifier.

2  "enableDeltaUpdates": true,
3  "deltaUpdatesPrimaryDatasetFields": ["url"]

Delete outdated data

The integration can also delete data from Pinecone that hasn't been crawled for a specified period. This is useful when data in the Pinecone database becomes outdated, such as when a page is removed from a website.

This is controlled by the expiredObjectDeletionPeriodDays setting, which automatically deletes data older than the specified number of days. For each crawl, the last_seen_at metadata field is updated. When a database object has not been seen for more than expiredObjectDeletionPeriodDays days, it is deleted.

The specific value of expiredObjectDeletionPeriodDays depends on your use case. Typically, if a website is crawled daily, expiredObjectDeletionPeriodDays can be set to 7. If you crawl weekly, it can be set to 30. To disable this feature, set expiredObjectDeletionPeriodDays to 0.

2  "enableDeltaUpdates": true,
3  "expiredObjectDeletionPeriodDays": 30


This integration will save the selected fields from your Actor to Pinecone.

Example configuration

Full Input Example for Website Content Crawler Actor with Pinecone integration

2  "pineconeApiKey": "YOUR-PINECONE-API-KEY",
3  "pineconeIndexName": "apify",
4  "embeddingsApiKey": "YOUR-OPENAI-API-KEY",
5  "embeddingsConfig": {
6    "model": "text-embedding-3-small"
7  },
8  "embeddingsProvider": "OpenAI",
9  "datasetFields": [
10    "text"
11  ],
12  "enableDeltaUpdates": true,
13  "deltaUpdatesPrimaryDatasetFields": ["url"],
14  "expiredObjectDeletionPeriodDays": 7,
15  "performChunking": true,
16  "chunkSize": 2000,
17  "chunkOverlap": 200


2  "pineconeApiKey": "YOUR-PINECONE-API-KEY",
3  "pineconeIndexName": "apify-pinecone"

OpenAI embeddings

2  "embeddingsApiKey": "YOUR-OPENAI-API-KEY",
3  "embeddings": "OpenAI",
4  "embeddingsConfig": {"model":  "text-embedding-3-large"}

Cohere embeddings

2  "embeddingsApiKey": "YOUR-COHERE-API-KEY",
3  "embeddings": "Cohere",
4  "embeddingsConfig": {"model":  "embed-multilingual-v3.0"}
Maintained by Apify
Actor metrics
  • 7 monthly users
  • 3 stars
  • 60.7% runs succeeded
  • 15 hours response time
  • Created in Jun 2024
  • Modified 4 days ago