AgentSkillsCN

knowledge-base

本地知识、嵌入向量与信息检索(RAG)的管理

SKILL.md
--- frontmatter
name: knowledge-base
description: Management of local knowledge, embeddings, and information retrieval (RAG)

Knowledge Base & RAG Skill

Overview

This skill provides capabilities for storing, indexing, and retrieving information from collected research papers and documents. It enables the agents to "remember" details from papers they have read.

Capabilities

1. Ingestion

  • Extract text from PDFs/Markdown.
  • Chunk text into manageable segments (e.g., paragraphs or 500-token chunks).
  • Associate metadata (Title, Authors, Year) with chunks.

2. Retrieval (RAG)

  • Semantic Search: Find chunks semantically related to a query (requires Vector Store).
  • Keyword Search: Find chunks containing specific terms (fallback).
  • Context Assembly: formatting retrieved chunks for LLM context window.

Usage

Agents should use the rag_engine.py script to interact with the knowledge base.

python
from rag_engine import KnowledgeBase

kb = KnowledgeBase()
kb.ingest(text="...", metadata={"title": "..."})
results = kb.search("query")