본문으로 건너뛰기
Skillpedia
에이전트40k · #7324

pinecone-rag

하는 일

이 도구는 인공지능 에이전트가 중요한 정보를 기억하거나 많은 문서를 검색할 수 있는 시스템을 만들도록 돕습니다. 비슷한 정보를 빠르게 찾는 데 특화된 데이터베이스인 Pinecone을 사용합니다.

사용하는 경우

  • ✓AI 에이전트가 지난 대화를 기억하게 하고 싶을 때.
  • ✓PDF나 웹 페이지 같은 많은 문서가 있고, AI가 가장 관련성 높은 부분을 찾기를 원할 때.
  • ✓AI가 특정 문서 모음의 정보를 사용해 질문에 답하도록 하고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/pinecone-rag/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 업무 문서에 대한 질문에 AI가 답하도록 하고 싶습니다. 우리가 이미 논의한 내용도 기억하도록 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

먼저 Pinecone에 '데이터베이스'를 설정합니다. 그다음 문서나 정보를 AI가 이해하는 형식으로 바꿔 Pinecone에 보냅니다. 마지막으로 AI가 이 정보를 검색하고 활용해 질문에 답하거나 내용을 기억합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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"]]
    }

…
자주 묻는 질문

Pinecone 같은 '벡터 데이터베이스'는 무엇인가요?

정확한 키워드뿐 아니라 의미를 기준으로 정보를 찾도록 최적화된 특별한 데이터베이스입니다. 텍스트를 숫자(벡터)로 바꾸고, 가장 비슷한 것을 찾습니다.

'RAG'는 무엇을 뜻하나요?

RAG는 Retrieval-Augmented Generation(검색 증강 생성)의 약자입니다. 답을 만들기 전에 AI가 관련 정보를 검색하게 해서, 더 정확하고 잘 아는 답을 만드는 방법입니다.

이것을 쓰려면 코딩을 알아야 하나요?

이 도구는 이런 시스템을 만드는 데 도움을 주도록 설계되었지만, 직접 쓰려면 어느 정도 기술 지식이 필요할 수 있습니다. 목표는 비개발자에게도 과정을 쉽게 만드는 것입니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
40k
순위
#7324
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬