rag-service

Lin-A1's avatarfrom Lin-A1

RAG多路检索服务,提供基于向量数据库的语义检索、Rerank重排序,支持历史内容召回

⭐1stars🔀0forks📁View on GitHub🕐Updated Jan 8, 2026

When & Why to Use This Skill

This Claude skill provides a high-performance RAG (Retrieval-Augmented Generation) multi-path retrieval service. By integrating the Milvus vector database for semantic search and employing Rerank models for precision, it enables AI agents to efficiently store, manage, and recall information from massive document sets with high accuracy. It is designed to bridge the gap between static LLM knowledge and dynamic, proprietary data.

Use Cases

  • Enterprise Knowledge Management: Enabling AI agents to search through internal wikis, PDFs, and technical documentation to provide accurate, context-aware answers to employee queries.
  • Automated Customer Support: Powering support bots with the ability to retrieve precise troubleshooting steps and product specifications from a vast knowledge base to resolve tickets efficiently.
  • Technical Research and Discovery: Assisting researchers in navigating large volumes of academic papers or code repositories using semantic similarity to find relevant information that keyword searches might miss.
  • Long-term Agent Memory: Providing a persistent storage layer for agents to save and recall historical interactions or specific user-provided data, ensuring continuity and personalized context in long-running conversations.
namerag-service
description高性能 RAG 多路检索服务。集成 Milvus 向量数据库进行语义检索,并结合 Rerank 模型进行精准重排序,支持海量文档的高效存储与历史内容召回。

功能

RAG 多路检索服务,提供:

  1. 向量语义检索 - 基于 Milvus 的向量相似度搜索
  2. Rerank 重排序 - 对检索结果进行精排
  3. 文档存储 - 保存文档到向量数据库

调用方式

from services.rag_service.client import RAGServiceClient

client = RAGServiceClient()

# 健康检查
status = client.health()

# 语义检索
result = client.retrieve(
    query="Python 异步编程最佳实践",
    top_k=5,
    min_score=0.85,
    rerank=True
)
print(result["results"])

# 便捷方法:只获取文本列表
texts = client.retrieve_texts(query="Python 异步编程", top_k=5)

# 保存文档
client.save(documents=[
    {"text": "文档内容...", "metadata": {"title": "标题", "url": "..."}}
])

返回格式

retrieve

{
  "query": "Python 异步编程",
  "results": [
    {
      "id": "abc123",
      "text": "Python异步编程基于asyncio库...",
      "score": 0.92,
      "metadata": {"title": "Python官方文档", "url": "..."}
    }
  ],
  "total": 3,
  "elapsed_ms": 45.2,
  "from_cache": false
}

save

{
  "saved_count": 5,
  "collection_name": "websearch_results"
}