Spaces:
Paused
Paused
Update RAG_Learning_Assistant_with_Streaming.py via admin tool
Browse files
RAG_Learning_Assistant_with_Streaming.py
CHANGED
|
@@ -73,7 +73,7 @@ Focus on:
|
|
| 73 |
4. Standards, methods, or procedures
|
| 74 |
5. Materials, equipment, or structures
|
| 75 |
|
| 76 |
-
Return the entities as a JSON array of strings. Only include the most important and specific entities."""
|
| 77 |
|
| 78 |
# 对话历史
|
| 79 |
self.conversation_history = []
|
|
@@ -283,9 +283,9 @@ Return the entities as a JSON array of strings. Only include the most important
|
|
| 283 |
entities.extend(special_terms)
|
| 284 |
|
| 285 |
# 去重并返回
|
| 286 |
-
return list(set(entities))[:
|
| 287 |
|
| 288 |
-
def enhanced_search(self, query: str, top_k: int =
|
| 289 |
"""
|
| 290 |
增强搜索:重写查询 -> 提取实体 -> 基于实体搜索(优化版本)
|
| 291 |
|
|
|
|
| 73 |
4. Standards, methods, or procedures
|
| 74 |
5. Materials, equipment, or structures
|
| 75 |
|
| 76 |
+
Return the entities as a JSON array of strings. Only include the most important and specific entities, and list them from the most important to least important."""
|
| 77 |
|
| 78 |
# 对话历史
|
| 79 |
self.conversation_history = []
|
|
|
|
| 283 |
entities.extend(special_terms)
|
| 284 |
|
| 285 |
# 去重并返回
|
| 286 |
+
return list(set(entities))[:5] # 最多返回5个实体
|
| 287 |
|
| 288 |
+
def enhanced_search(self, query: str, top_k: int = 4) -> Tuple[str, str, List[str], List[Tuple[Dict, float, Dict]]]:
|
| 289 |
"""
|
| 290 |
增强搜索:重写查询 -> 提取实体 -> 基于实体搜索(优化版本)
|
| 291 |
|