更新词库,添加同义词和描述,删除冗余条目,优化意图识别逻辑,调整向量检索参数.
This commit is contained in:
@@ -206,7 +206,7 @@ class IntentRecognizer:
|
||||
try:
|
||||
# 对matched_terms中的每个关键字进行向量检索
|
||||
for current_key in query_keys:
|
||||
vector_results = self.noun_retriever.query(current_key, top_k=3, use_intersection=True)
|
||||
vector_results = self.noun_retriever.query(current_key, top_k=5, use_intersection=False)
|
||||
current_key_terms = set()
|
||||
# 添加向量检索结果
|
||||
for result in vector_results:
|
||||
@@ -391,6 +391,8 @@ class IntentRecognizer:
|
||||
|
||||
return None
|
||||
|
||||
count=1
|
||||
|
||||
def _fill_slots_with_llm(self, query: str, classification: Classification, slot_model_class: type) -> Any:
|
||||
"""
|
||||
使用LLM进行槽位填充
|
||||
@@ -405,7 +407,6 @@ class IntentRecognizer:
|
||||
"""
|
||||
# 准备提示词
|
||||
slot_parser = PydanticOutputParser(pydantic_object=slot_model_class)
|
||||
model_schema = json.dumps(slot_model_class.model_json_schema(), ensure_ascii=False)
|
||||
|
||||
formatted_prompt = slot_filling_prompt.format(
|
||||
query=query,
|
||||
|
||||
Reference in New Issue
Block a user