Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m34s
- 重写 rag_core/vector_store.py:完全异步实现 aadd_documents、asimilarity_search - 重写 app/rag/retriever.py:异步混合检索,移除同步兼容代码 - 修改 rag_indexer/index_builder.py:全链路异步调用 - 删除 rag_core/retriever_factory.py:不再使用 LangChain ParentDocumentRetriever - 清理冗余导入和代码:移除 model_services 兼容、不需要的异常导入 - 更新 rag_indexer/README.md:反映新架构 核心改进: - 完全异步化:索引构建和检索全链路 async/await - 自定义实现:不再依赖 LangChain 的 ParentDocumentRetriever - 双向量支持:子文档同时存储 dense + sparse 向量到 Qdrant - 架构清晰:rag_core 公共组件、rag_indexer 索引、app/rag 检索
38 lines
940 B
Python
38 lines
940 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
简单测试脚本:测试文档里真正有的内容
|
|
"""
|
|
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
|
|
from qdrant_client import models
|
|
from backend.rag_core import QdrantHybridStore, get_sparse_embedder
|
|
from backend.app.model_services import get_embedding_service
|
|
|
|
|
|
def test_dense_retrieval():
|
|
"""测试稠密检索"""
|
|
print("="*70)
|
|
print("测试稠密检索...")
|
|
print("="*70)
|
|
|
|
embeddings = get_embedding_service()
|
|
vs = QdrantHybridStore(collection_name="rag_documents", embeddings=embeddings)
|
|
|
|
query = "黄双银" # 用文档里真正有的名字查询
|
|
print(f"\n查询: {query}")
|
|
|
|
results = vs.similarity_search(query, k=3)
|
|
|
|
print(f"\n找到 {len(results)} 个结果\n")
|
|
for i, doc in enumerate(results):
|
|
print(f"--- 结果 {i+1} ---")
|
|
print(doc.page_content[:200])
|
|
print()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_dense_retrieval()
|