LLM输出的内容先通过正则清理多余内容
This commit is contained in:
@@ -132,9 +132,48 @@ class QueryRewrite(BaseModel):
|
||||
"rewrite": "问题改写"
|
||||
}
|
||||
字段说明:
|
||||
rewrite 类型:str 描述:问题改写之后的内容
|
||||
"rewrite" 类型:str 描述:问题改写之后的内容
|
||||
"""
|
||||
|
||||
|
||||
# 意图优化环节数据模型
|
||||
class StepBackPrompt(BaseModel):
|
||||
"""后退提示数据模型"""
|
||||
original_query: str = Field(description="原始查询")
|
||||
can_use_back_prompt: bool = Field(description="原始查询是否可以进行后退提示(true/false),如果原始查询没有限定词或其他限定词语,则不能进行后退提示")
|
||||
step_back_query: List[str] = Field(description="后退提示生成的抽象查询(多个)")
|
||||
|
||||
@classmethod
|
||||
def get_format_instructions(cls):
|
||||
return """
|
||||
格式如下,必须严格以纯JSON格式输出
|
||||
{
|
||||
"original_query": "原始查询",
|
||||
"can_use_back_prompt": "原始查询是否可以进行后退提示(true/false),如果原始查询没有限定词或其他限定词语,则不能进行后退提示",
|
||||
"step_back_query": "后退提示生成的抽象查询(多个)"
|
||||
}
|
||||
字段说明:
|
||||
"original_query" 类型:str 描述:用户输入的原始查询
|
||||
"can_use_back_prompt" 类型:bool 描述:原始查询是否可以进行后退提示(true/false),如果原始查询没有限定词或其他限定词语,则不能进行后退提示
|
||||
"step_back_query" 类型:list[str] 描述:后退提示生成的抽象查询(多个)
|
||||
"""
|
||||
|
||||
|
||||
class FollowUpQuestions(BaseModel):
|
||||
"""后续问题数据模型"""
|
||||
original_query: str = Field(description="原始查询")
|
||||
follow_up_query: str = Field(description="基于历史对话生成的独立问题")
|
||||
|
||||
class HypotheticalDocument(BaseModel):
|
||||
"""假设文档数据模型"""
|
||||
original_query: str = Field(description="原始查询")
|
||||
hypothetical_answer: str = Field(description="假设性回答")
|
||||
|
||||
class MultiQuestions(BaseModel):
|
||||
"""多问题查询数据模型"""
|
||||
original_query: str = Field(description="原始查询")
|
||||
sub_questions: List[str] = Field(description="从不同角度生成的子问题列表")
|
||||
|
||||
##########################槽位模型###########################
|
||||
class SlotBase(BaseModel):
|
||||
"""槽位基础模型"""
|
||||
@@ -329,41 +368,3 @@ class IntentAndSlotResult(BaseModel):
|
||||
ProblemDiagnosisSlots,
|
||||
OtherSlots
|
||||
]
|
||||
|
||||
# 意图优化环节数据模型
|
||||
class StepBackPrompt(BaseModel):
|
||||
"""后退提示数据模型"""
|
||||
original_query: str = Field(description="原始查询")
|
||||
can_use_back_prompt: bool = Field(description="原始查询是否可以进行后退提示(true/false),如果原始查询没有限定词或其他限定词语,则不能进行后退提示")
|
||||
step_back_query: List[str] = Field(description="后退提示生成的抽象查询(多个)")
|
||||
|
||||
@classmethod
|
||||
def get_format_instructions(cls):
|
||||
return """
|
||||
格式如下,必须严格以纯JSON格式输出
|
||||
{
|
||||
"original_query": "原始查询",
|
||||
"can_use_back_prompt": "原始查询是否可以进行后退提示(true/false),如果原始查询没有限定词或其他限定词语,则不能进行后退提示",
|
||||
"step_back_query": "后退提示生成的抽象查询(多个)"
|
||||
}
|
||||
字段说明:
|
||||
original_query 类型:str 描述:用户输入的原始查询
|
||||
can_use_back_prompt 类型:bool 描述:原始查询是否可以进行后退提示(true/false),如果原始查询没有限定词或其他限定词语,则不能进行后退提示
|
||||
step_back_query 类型:List[str] 描述:后退提示生成的抽象查询(多个)
|
||||
"""
|
||||
|
||||
|
||||
class FollowUpQuestions(BaseModel):
|
||||
"""后续问题数据模型"""
|
||||
original_query: str = Field(description="原始查询")
|
||||
follow_up_query: str = Field(description="基于历史对话生成的独立问题")
|
||||
|
||||
class HypotheticalDocument(BaseModel):
|
||||
"""假设文档数据模型"""
|
||||
original_query: str = Field(description="原始查询")
|
||||
hypothetical_answer: str = Field(description="假设性回答")
|
||||
|
||||
class MultiQuestions(BaseModel):
|
||||
"""多问题查询数据模型"""
|
||||
original_query: str = Field(description="原始查询")
|
||||
sub_questions: List[str] = Field(description="从不同角度生成的子问题列表")
|
||||
Reference in New Issue
Block a user