بنقرة واحدة
rag-pipelines
RAG pipeline design — chunking, embeddings, retrieval strategies, evaluation, and demo patterns.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
RAG pipeline design — chunking, embeddings, retrieval strategies, evaluation, and demo patterns.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Tool-agnostic search — query construction, tool selection, source trust hierarchy.
Auto-continue through todos with idle detection and safety gates. Use for multi-step orchestration.
Level 2 — Pantheon-native context compression with priority scoring, semantic summarization, downstream-aware compression, budget allocation, and cross-references
Automated visual review pipeline — Playwright screenshots, self-analysis, fix loop, escalation. Used by Aphrodite for UI verification.
Multi-agent orchestration with model routing, category delegation, and sprint management. Use for coordinating Pantheon agents.
MCP security hardening — credential leakage prevention, input sanitization, and tool access control. Use for reviewing agent MCP configurations.
| name | rag-pipelines |
| description | RAG pipeline design — chunking, embeddings, retrieval strategies, evaluation, and demo patterns. |
| context | fork |
| globs | [] |
| alwaysApply | false |
Retrieval-Augmented Generation pipeline design: chunking, embeddings, vector stores, retrieval strategies, and evaluation.
Documents → Chunk → Embed → Store → Retrieve → Generate
| Strategy | Best For | Chunk Size |
|---|---|---|
| Fixed-size | General docs | 500-1000 tokens |
| Semantic | Long-form content | By paragraph/section |
| Code-aware | Source code | By function/class |
| Recursive | Mixed content | 1000 → 500 → 200 tokens |
from langchain.text_splitter import RecursiveCharacterTextSplitter
splitter = RecursiveCharacterTextSplitter(
chunk_size=1000,
chunk_overlap=200,
separators=["\n\n", "\n", ". ", " ", ""]
)
| Model | Dimensions | Speed | Quality |
|---|---|---|---|
text-embedding-3-small | 1536 | Fast | Good |
text-embedding-3-large | 3072 | Medium | Best |
bge-large-en | 1024 | Fast | Good |
e5-large-v2 | 1024 | Fast | Good |
| Store | Use Case | Scaling |
|---|---|---|
| Pinecone | Production, managed | Auto-scales |
| Weaviate | Production, self-hosted | Horizontal |
| pgvector | PostgreSQL shops | Vertical |
| Chroma | Prototyping, local | Single-node |
from langchain.vectorstores import Chroma
vector_store = Chroma.from_documents(
documents=chunks,
embedding=embeddings,
persist_directory="./chroma_db"
)
retriever = vector_store.as_retriever(search_type="similarity", k=4)
retriever = vector_store.as_retriever(
search_type="mmr",
search_kwargs={"k": 4, "lambda_mult": 0.7}
)
from langchain.retrievers import EnsembleRetriever
retriever = EnsembleRetriever(
retrievers=[bm25_retriever, vector_retriever],
weights=[0.3, 0.7]
)
from langchain.retrievers.self_query.base import SelfQueryRetriever
retriever = SelfQueryRetriever.from_llm(
llm, vector_store, document_contents, metadata_field_info
)
from ragas import evaluate
from ragas.metrics import faithfulness, answer_relevance, context_precision
result = evaluate(
dataset=eval_dataset,
metrics=[faithfulness, answer_relevance, context_precision]
)
| Metric | Target |
|---|---|
| Faithfulness | ≥0.8 |
| Answer Relevance | ≥0.8 |
| Context Precision | ≥0.7 |
import gradio as gr
def answer(question):
return qa_chain.run(question)
gr.Interface(fn=answer, inputs="text", outputs="text").launch()
import streamlit as st
question = st.text_input("Ask a question")
if question:
st.write(qa_chain.run(question))