Skip to main content

Overview

Pinecone is a fully managed vector database that enables semantic search and RAG (Retrieval-Augmented Generation) applications. The Pinecone tool allows you to query vector indexes for similar vectors using semantic similarity.

Key Features

  • PINECONE_CREATE_INDEX
    • Create new serverless vector indexes
    • Configure vector dimension and distance metric
    • Select cloud provider and deployment region
    • Optional deletion protection
    • Wait-until-ready option for immediate use
  • PINECONE_QUERY
    • Search for similar vectors using semantic similarity
    • Dual-mode operation: Vector query OR text query with integrated inference
    • Support for top-K results retrieval
    • Metadata filtering with Pinecone filter syntax
    • Namespace isolation for data partitioning
    • Similarity threshold filtering (minScore)
    • Optional inclusion of metadata and vector values
  • PINECONE_UPSERT
    • Insert or update vectors in Pinecone index
    • Dual-mode operation: Vector upsert OR document upsert with integrated inference
    • Batch operations (up to 100 vectors/documents per request)
    • Metadata support for rich vector annotations
    • Namespace isolation for data organization

Authentication

You need a Pinecone API key to use this tool. You can obtain one from the Pinecone Console. Note: Treat API keys as sensitive information and never commit them to public repositories.

Examples

Example: Create Index and Upsert Documents (Integrated Inference)

This example shows the complete workflow using Pinecone’s integrated inference feature - no external embedding tool needed!
# Step 1: Create a serverless index
- id: create_index
  name: create_index
  tool: PINECONE_CREATE_INDEX
  config:
    - name: apiKey
      value: "{{secrets.PINECONE_API_KEY}}"
  input:
    - name: indexName
      value: knowledge-base
    - name: dimension
      value: 1024
    - name: metric
      value: cosine
    - name: cloud
      value: aws
    - name: region
      value: us-east-1
    - name: waitUntilReady
      value: true

# Step 2: Upload documents with automatic embedding
- id: upload_docs
  name: upload_docs
  tool: PINECONE_UPSERT
  config:
    - name: apiKey
      value: "{{secrets.PINECONE_API_KEY}}"
  input:
    - name: indexName
      value: knowledge-base
    - name: documents
      value: |
        [
          {
            "id": "doc1",
            "text": "Pinecone is a vector database optimized for AI applications.",
            "metadata": {"category": "intro", "source": "docs"}
          },
          {
            "id": "doc2",
            "text": "Integrated inference automatically generates embeddings from your text.",
            "metadata": {"category": "features", "source": "docs"}
          }
        ]

# Step 3: Query with text (automatic embedding)
- id: search
  name: search
  tool: PINECONE_QUERY
  config:
    - name: apiKey
      value: "{{secrets.PINECONE_API_KEY}}"
  input:
    - name: indexName
      value: knowledge-base
    - name: query
      value: "How does Pinecone handle embeddings?"
    - name: topK
      value: 3
    - name: includeMetadata
      value: true

Example: Query with Reranking for Improved Relevance

Reranking re-scores initial results to improve relevance. This is especially useful for complex queries.
- id: search_with_rerank
  name: search_with_rerank
  tool: PINECONE_QUERY
  config:
    - name: apiKey
      value: "{{secrets.PINECONE_API_KEY}}"
  input:
    - name: indexName
      value: knowledge-base
    - name: query
      value: "How does Pinecone handle embeddings?"
    - name: topK
      value: 10
    - name: includeMetadata
      value: true
    - name: rerankModel
      value: bge-reranker-v2-m3  # Options: cohere-rerank-3.5, bge-reranker-v2-m3, pinecone-rerank-v0
    - name: rerankTopN
      value: 3
    - name: rerankRankFields
      value: '["text"]'
    - name: fields
      value: '["category", "text"]'

Example: Traditional Semantic Search with OpenAI Embeddings

- id: generate_embeddings
  name: generate_embeddings
  tool: OPENAI_CREATE_EMBEDDING
  config:
    - name: api_key
      value: "{{secrets.OPENAI_API_KEY}}"
  input:
    - name: input
      value: What is semantic search?
    - name: model
      value: text-embedding-3-large

- id: search_pinecone
  name: search_pinecone
  tool: PINECONE_QUERY
  config:
    - name: apiKey
      value: "{{secrets.PINECONE_API_KEY}}"
  input:
    - name: indexName
      value: my-docs-index
    - name: vector
      value: "{{steps.generate_embeddings.result.data[0].embedding}}"
    - name: topK
      value: 5
    - name: minScore
      value: 0.7
    - name: includeMetadata
      value: true

- id: generate_answer
  name: generate_answer
  tool: OPENAI_INVOKE
  config:
    - name: version
      value: gpt-4
  input:
    - name: prompt
      value: |
        Answer the following question based on the context provided.

        Context:
        {{steps.search_pinecone.result.matches[0].metadata.text}}
        {{steps.search_pinecone.result.matches[1].metadata.text}}

        Question: What is semantic search?

Example: Search with Metadata Filtering

- id: filtered_search
  name: filtered_search
  tool: PINECONE_QUERY
  config:
    - name: apiKey
      value: "{{secrets.PINECONE_API_KEY}}"
  input:
    - name: indexName
      value: my-docs-index
    - name: vector
      value: "[0.1, 0.2, 0.3, ...]"
    - name: topK
      value: 10
    - name: filter
      value: '{"category": {"$eq": "technology"}, "year": {"$gte": 2020}}'
    - name: namespace
      value: production

Parameters

PINECONE_CREATE_INDEX

ParameterTypeRequiredDefaultDescription
indexNamestringYes-Name of the index (lowercase alphanumeric and hyphens, max 45 chars)
dimensionnumberYes-Vector dimension (e.g., 1536 for OpenAI ada-002)
metricstringNocosineDistance metric: cosine, euclidean, or dotproduct
cloudstringNoawsCloud provider: aws, gcp, or azure
regionstringYes-Deployment region (e.g., us-east-1)
deletionProtectionstringNodisabledEnable deletion protection: enabled or disabled
waitUntilReadybooleanNotrueWait until index is ready before returning

PINECONE_QUERY

ParameterTypeRequiredDefaultDescription
indexNamestringYes-The name of the Pinecone index to query
vectornumber[]No*-Query vector as array of numbers
querystringNo*-Text query for integrated inference (automatic embedding)
topKnumberNo10Number of results to return (1-100)
namespacestringNo-Namespace to query within the index
filterobjectNo-Metadata filter using Pinecone filter syntax
minScorenumberNo-Minimum similarity score threshold (0-1)
includeMetadatabooleanNotrueInclude metadata in results
includeValuesbooleanNofalseInclude vector values in results
*Either vector or query must be provided, but not both.

PINECONE_UPSERT

ParameterTypeRequiredDefaultDescription
indexNamestringYes-The name of the Pinecone index
vectorsarrayNo*-Array of vector objects (id, values, metadata)
documentsarrayNo*-Array of document objects for integrated inference (id, text, metadata)
namespacestringNo-Namespace for data organization
*Either vectors or documents must be provided, but not both.

Output

The tool returns an object with the following structure:
{
  "matches": [
    {
      "id": "vec1",
      "score": 0.95,
      "metadata": {
        "title": "Document Title",
        "text": "Document content...",
        "category": "technology"
      }
    }
  ],
  "namespace": "production",
  "usage": {
    "readUnits": 5
  }
}

Use Cases

RAG (Retrieval-Augmented Generation)

Combine Pinecone with OpenAI to build RAG applications:
  1. Generate embeddings from user query
  2. Search Pinecone for relevant documents
  3. Use retrieved context in LLM prompts
Search documents by meaning rather than keywords:
  • Find similar articles
  • Recommend related content
  • Discover relevant information

Question Answering

Build Q&A systems with context retrieval:
  • Technical documentation search
  • Customer support knowledge base
  • Research paper discovery

Resources