Pinecone Vector Store

Pinecone is a fully managed, scalable vector database optimized for similarity search. With Quarkus LangChain4j, you can use Pinecone as a vector store to implement Retrieval-Augmented Generation (RAG) pipelines.

This guide explains how to configure and use Pinecone as a document store for embedded vectors.

Prerequisites

To use Pinecone, you need:

  • A Pinecone account and an active API key

  • A Pinecone index with a configured dimension matching your embedding model

  • The Pinecone index must support the same vector similarity metric as your use case (e.g., cosine)

For more details, visit: https://docs.pinecone.io/docs/quickstart

Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.quarkiverse.langchain4j</groupId>
    <artifactId>quarkus-langchain4j-pinecone</artifactId>
    <version>1.0.2</version>
</dependency>

Configuration

You must configure your Pinecone API key, environment, index name, and embedding dimension in application.properties.

quarkus.langchain4j.pinecone.api-key=your-api-key
quarkus.langchain4j.pinecone.environment=us-west1-gcp
quarkus.langchain4j.pinecone.project-id=your-project-id
quarkus.langchain4j.pinecone.index-name=my-index
quarkus.langchain4j.pinecone.dimension=1536

See below for full configuration options:

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

The API key to Pinecone.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_API_KEY

string

required

Environment name, e.g. gcp-starter or northamerica-northeast1-gcp.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_ENVIRONMENT

string

required

ID of the project.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_PROJECT_ID

string

required

Name of the index within the project. If the index doesn’t exist, it will be created.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_INDEX_NAME

string

required

Dimension of the embeddings in the index. This is required only in case that the index doesn’t exist yet and needs to be created.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_DIMENSION

int

The type of the pod to use. This is only used if the index doesn’t exist yet and needs to be created. The format: One of s1, p1, or p2 appended with . and one of x1, x2, x4, or x8.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_POD_TYPE

string

s1.x1

The timeout duration for the index to become ready. Only relevant if the index doesn’t exist yet and needs to be created. If not specified, 1 minute will be used.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_INDEX_READINESS_TIMEOUT

Duration 

The namespace.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_NAMESPACE

string

The name of the field that contains the text segment.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_TEXT_FIELD_NAME

string

text

The timeout duration for the Pinecone client. If not specified, 5 seconds will be used.

Environment variable: QUARKUS_LANGCHAIN4J_PINECONE_TIMEOUT

Duration 

About the Duration format

To write duration values, use the standard java.time.Duration format. See the Duration#parse() Java API documentation for more information.

You can also use a simplified format, starting with a number:

  • If the value is only a number, it represents time in seconds.

  • If the value is a number followed by ms, it represents time in milliseconds.

In other cases, the simplified format is translated to the java.time.Duration format for parsing:

  • If the value is a number followed by h, m, or s, it is prefixed with PT.

  • If the value is a number followed by d, it is prefixed with P.

Embedding Dimension

Make sure the configured dimension matches the embedding model you’re using:

  • OpenAI text-embedding-ada-002 → 1536

  • AllMiniLmL6V2QuantizedEmbeddingModel → 384

If the dimension mismatches the index configuration, insertion and querying will fail.

Your Pinecone index must be created with the correct vector dimension ahead of time* Quarkus will not automatically provision or reconfigure indexes.

Usage Example

Once installed and configured, you can use the Pinecone vector store to ingest and retrieve embedded documents:

package io.quarkiverse.langchain4j.samples;

import static dev.langchain4j.data.document.splitter.DocumentSplitters.recursive;

import java.util.List;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

import dev.langchain4j.data.document.Document;
import dev.langchain4j.model.embedding.EmbeddingModel;
import dev.langchain4j.store.embedding.EmbeddingStoreIngestor;
import io.quarkiverse.langchain4j.pinecone.PineconeEmbeddingStore;

@ApplicationScoped
public class IngestorExampleWithPinecone {

    /**
     * The embedding store (the database).
     * The bean is provided by the quarkus-langchain4j-pinecone extension.
     */
    @Inject
    PineconeEmbeddingStore store;

    /**
     * The embedding model (how is computed the vector of a document).
     * The bean is provided by the LLM (like openai) extension.
     */
    @Inject
    EmbeddingModel embeddingModel;

    public void ingest(List<Document> documents) {
        EmbeddingStoreIngestor ingestor = EmbeddingStoreIngestor.builder()
                .embeddingStore(store)
                .embeddingModel(embeddingModel)
                .documentSplitter(recursive(500, 0))
                .build();
        // Warning - this can take a long time...
        ingestor.ingest(documents);
    }
}

This example demonstrates how to store text segments along with embeddings and metadata in Pinecone.

How It Works

The Pinecone store integration works by:

  • Converting input text into embedding vectors using your configured EmbeddingModel

  • Storing each vector with associated metadata and a unique ID

  • Executing similarity queries using Pinecone’s top-k vector search

  • Returning the most relevant matches for inclusion in a RAG prompt

Internally, the extension uses Pinecone’s REST API (via the official Java SDK) to:

  • Upsert vectors (/vectors/upsert)

  • Query vectors (/query)

  • Fetch metadata for matched entries

Summary

To use Pinecone as a vector store for RAG with Quarkus LangChain4j:

  • Create a Pinecone index with the correct vector dimension

  • Add the quarkus-langchain4j-pinecone dependency

  • Configure API credentials, environment, and index parameters

  • Use the PineconeEmbeddingStore to ingest and retrieve content