Saltar al contenido
Skillpedia
Agentes40 mil · #7324

pinecone-rag

Qué hace

Esta herramienta sirve para crear sistemas que permiten a las inteligencias artificiales (agentes) recordar información importante o buscar en grandes cantidades de documentos. Usa Pinecone, una base de datos especial para hacer búsquedas rápidas de información parecida.

Cuándo usarla

  • ✓Cuando quieres que un agente de IA recuerde conversaciones pasadas.
  • ✓Cuando tienes muchos documentos (como PDFs o páginas web) y quieres que la IA encuentre las partes más relevantes.
  • ✓Cuando quieres que la IA responda preguntas usando información concreta de un conjunto de documentos.

Link de la skill

https://github.com/github/awesome-copilot/blob/main/skills/pinecone-rag/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/github/awesome-copilot/blob/main/skills/pinecone-rag/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Quiero que la IA responda preguntas sobre mis documentos de trabajo, recordando lo que ya hemos comentado.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

Primero, configuras una 'base de datos' en Pinecone. Después, conviertes tus documentos o información a un formato que la IA entiende y los envías a Pinecone. Por último, la IA puede buscar y usar esa información para responder preguntas o recordar cosas.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Pinecone RAG Skill

This skill guides you through building a production RAG pipeline or persistent agent memory system using Pinecone. Follow the workflow from start to finish — don't skip steps or jump to code before understanding what the user actually needs.

Before you start — ask one question

Before writing any code, identify which of these two use cases applies:

A — RAG over documents: User wants to index a corpus (PDFs, docs, code, web pages) and retrieve relevant chunks to ground LLM responses.

B — Agent memory: User wants an agent to remember facts, decisions, or context across sessions or across multiple agents sharing a knowledge base.

The setup is similar but the namespace strategy and retrieval patterns differ. If the user hasn't said, ask: "Is this for document retrieval, agent memory, or both?" Then follow the relevant workflow below.


Step 1 — Choose your index configuration

Pick the index type before writing any code. Getting this wrong means re-creating the index later.

Serverless (recommended for most cases)

from pinecone import Pinecone, ServerlessSpec

pc = Pinecone(api_key="PINECONE_API_KEY")

if "my-index" not in pc.list_indexes().names():
    pc.create_index(
        name="my-index",
        dimension=1536,        # must match your embedding model exactly
        metric="cosine",
        spec=ServerlessSpec(cloud="aws", region="us-east-1")
    )
index = pc.Index("my-index")

Pod-based (for consistent high-throughput production)

from pinecone import PodSpec

pc.create_index(
    name="my-index-prod",
    dimension=1536,
    metric="cosine",
    spec=PodSpec(environment="us-east1-gcp", pod_type="p1.x1")
)

Dimension quick reference — match this exactly to your embedding model:

Model Dimension
text-embedding-3-small 1536
text-embedding-3-large 3072
voyage-3 / voyage-multimodal-3 1024
BAAI/bge-large-en-v1.5 1024
intfloat/multilingual-e5-large (Arabic, Malay, Chinese) 1024

Checkpoint: Index exists, dimension matches embedding model, index.describe_index_stats() returns without error.


Step 2 — Embed and upsert documents

Always batch upserts — never upsert one vector at a time.

from openai import OpenAI

client = OpenAI()

def embed(texts: list[str]) -> list[list[float]]:
    res = client.embeddings.create(model="text-embedding-3-small", input=texts)
    return [r.embedding for r in res.data]

def upsert_docs(index, docs: list[dict], namespace: str = "default"):
    """docs = [{"id": "...", "text": "...", "metadata": {...}}]"""
    BATCH = 100
    for i in range(0, len(docs), BATCH):
        batch = docs[i:i + BATCH]
        vecs = [
            {
                "id": d["id"],
                "values": emb,
                "metadata": {**d.get("metadata", {}), "text": d["text"]}
            }
            for d, emb in zip(batch, embed([d["text"] for d in batch]))
        ]
        index.upsert(vectors=vecs, namespace=namespace)

Always store the original text in metadata — this avoids a second lookup at retrieval time.

Checkpoint: index.describe_index_stats() shows vector count > 0 in the target namespace.


Step 3 — Choose retrieval strategy

Dense (semantic) search — use for most cases

def search(index, query: str, top_k: int = 5, namespace: str = "default",
           filter: dict = None) -> list[dict]:
    [q_emb] = embed([query])
    results = index.query(
        vector=q_emb, top_k=top_k, namespace=namespace,
        include_metadata=True, filter=filter
    )
    return [{"text": m.metadata["text"], "score": m.score, "id": m.id}
            for m in results.matches]

Hybrid search (semantic + BM25 keyword) — use when corpus has exact terminology

Use hybrid when the domain has precise terms that semantic search misses: legal citations, medical codes, product SKUs, API method names.

from pinecone_text.sparse import BM25Encoder

bm25 = BM25Encoder().default()
bm25.fit([d["text"] for d in docs])  # fit once on your corpus

def hybrid_search(index, query: str, top_k: int = 5, alpha: float = 0.7):
    """alpha=1.0 is pure dense; alpha=0.0 is pure sparse."""
    dense = [v * alpha for v in embed([query])[0]]
    sparse_raw = bm25.encode_queries(query)
    sparse = {
        "indices": sparse_raw["indices"],
        "values": [v * (1 - alpha) for v in sparse_raw["values"]]
    }

…
Preguntas frecuentes

¿Qué es una 'base de datos vectorial' como Pinecone?

Es un tipo especial de base de datos optimizada para encontrar información según su significado, no solo según palabras exactas. Convierte el texto en números (vectores) y encuentra los más parecidos.

¿Qué significa 'RAG'?

RAG son las siglas de 'Retrieval-Augmented Generation' (generación aumentada por recuperación). Es una forma de que la IA busque información relevante antes de generar una respuesta, lo que la hace más precisa y mejor informada.

¿Necesito saber programar para usarlo?

La herramienta está pensada para crear estos sistemas, pero usarla directamente puede requerir algunos conocimientos técnicos. El objetivo es simplificar el proceso para quienes no programan.

Detalles

Descripción original del autor

Build production RAG pipelines and persistent agent memory using Pinecone as the vector database backend. ALWAYS USE THIS SKILL when the user mentions Pinecone, wants to index documents for semantic search, build a retrieval-augmented generation system, store agent memory across sessions, implement hybrid search, or connect an LLM to a searchable knowledge base — even if they don't say "Pinecone"

repo: github/awesome-copilot

Popularidad

Estrellas en GitHub
40 mil
Posición en el ranking
#7324
Licencia
MIT
Actualizada
15/10/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas