pinecone-rag
Skill này làm gì
Công cụ này giúp tạo hệ thống để trí tuệ nhân tạo (agent) ghi nhớ thông tin quan trọng hoặc tìm kiếm trong lượng lớn tài liệu. Nó dùng Pinecone, một cơ sở dữ liệu đặc biệt để tìm kiếm nhanh các thông tin tương tự.
Khi nào nên dùng
- ✓Khi bạn muốn một agent AI ghi nhớ các cuộc trò chuyện trước đây.
- ✓Khi bạn có nhiều tài liệu (như PDF hoặc trang web) và muốn AI tìm phần liên quan nhất.
- ✓Khi bạn muốn AI trả lời câu hỏi bằng thông tin cụ thể từ một tập tài liệu.
Liên kết skill
https://github.com/github/awesome-copilot/blob/main/skills/pinecone-rag/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi muốn AI trả lời câu hỏi về tài liệu công việc của tôi, đồng thời ghi nhớ những gì chúng ta đã thảo luận.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Trước tiên, bạn thiết lập một 'database' trong Pinecone. Sau đó, bạn chuyển tài liệu hoặc thông tin thành định dạng AI hiểu được và gửi đến Pinecone. Cuối cùng, AI có thể tìm kiếm và dùng thông tin này để trả lời câu hỏi hoặc ghi nhớ.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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"]]
}
…
Câu hỏi thường gặp
“Vector database” như Pinecone là gì?
Đây là loại cơ sở dữ liệu đặc biệt, tối ưu để tìm thông tin dựa trên ý nghĩa, không chỉ từ khóa chính xác. Nó chuyển văn bản thành các con số (vector) và tìm những vector giống nhất.
“RAG” nghĩa là gì?
RAG là viết tắt của 'Retrieval-Augmented Generation' (tạo sinh tăng cường truy xuất). Về cơ bản, đây là cách để AI tìm thông tin liên quan trước khi tạo câu trả lời, giúp câu trả lời chính xác và có căn cứ hơn.
Tôi có cần biết lập trình để dùng không?
Công cụ được thiết kế để giúp xây dựng các hệ thống này, nhưng sử dụng trực tiếp có thể cần một chút kiến thức kỹ thuật. Mục tiêu là đơn giản hóa quy trình cho người không lập trình.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 40k
- Vị trí xếp hạng
- #7324
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
acquire-codebase-knowledge
40kGiúp agent của bạn hiểu và ghi tài liệu cho một dự án mã nguồn có sẵn. Hữu ích khi đón thành viên mới hoặc nắm tổng quan về kiến trúc.
acreadiness-assess
40kGiúp agent của bạn đánh giá mức độ sẵn sàng cho AI của dự án và tạo báo cáo. Hữu ích để biết dự án đã sẵn sàng dùng công cụ AI đến đâu.
acreadiness-generate-instructions
40kGiúp agent của bạn tạo hướng dẫn cho công cụ AI dựa trên kết quả đánh giá. Hữu ích để cải thiện cách AI làm việc với mã và khắc phục các khoảng trống.
acreadiness-policy
40kGiúp agent của bạn xác định hoặc áp dụng chính sách đánh giá dự án bằng AI. Hữu ích để chuẩn hóa cách đánh giá dự án và đảm bảo tuân thủ.
Skill tương tự
add-model-provider
394kGiúp agent của bạn kết nối nhà cung cấp mô hình AI mới với OpenClaw bằng lệnh an toàn, giữ API key khỏi văn bản thuần và chạy thử.
acp-router
394kGiúp agent của bạn gửi một tác vụ đến trợ lý lập trình như Claude Code hoặc Cursor qua OpenClaw, để công việc chạy ngay trong công cụ đó.
browser-automation
394kHướng dẫn agent của bạn điều khiển trang web từng bước, gồm đăng nhập, tab và cách khôi phục khi trang ngừng phản hồi.