Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m22s
- 重构所有模块导入,移除 sys.path.insert - 统一使用 from backend.xxx 的绝对导入方式 - rag_core 包内使用相对导入(from .xxx) - 移动 visualize_graph.py 到 tools/ 目录 - 添加必要的 __init__.py 文件 - 清理废弃文档和脚本
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 QdrantVectorStore, 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 = QdrantVectorStore(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()
|