上传文件至 /
4.3更新
This commit is contained in:
@@ -33,6 +33,12 @@ deep_v3 = ChatOpenAI(
|
||||
temperature=0.1
|
||||
)
|
||||
|
||||
|
||||
# =========================================
|
||||
|
||||
# =========================================
|
||||
|
||||
|
||||
# 软件名重写
|
||||
def software_name_rewrite():
|
||||
PromptTemplate = """
|
||||
@@ -47,6 +53,7 @@ def software_name_rewrite():
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | qwen_llm | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
@@ -96,6 +103,7 @@ def retrieval_rewrite():
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | qwen_llm | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
@@ -114,6 +122,7 @@ def to_normal_rewrite():
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | deep_v3 | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
@@ -134,6 +143,7 @@ def query_function_rewrite():
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | deep_v3 | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
@@ -154,6 +164,7 @@ def operation_guidance_rewrite():
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | deep_v3 | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
@@ -176,6 +187,7 @@ def troubleshooting_rewrite():
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | deep_v3 | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
@@ -197,8 +209,93 @@ def access_rewrite():
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | deep_v3 | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
|
||||
# 全名扩写
|
||||
def full_name_extension():
|
||||
PromptTemplate = """
|
||||
你是一个智能问答重写助手,将用户问题和已知的软件名称重写为结构化、规范表达,符合以下范式:
|
||||
1. 【软件名】【其他】
|
||||
|
||||
# 例子
|
||||
输入:D3软件二次运输怎么计取
|
||||
输出:【博微配网工程计价通D3软件】【二次运输怎么计取】
|
||||
|
||||
输入:怎么添加特征段
|
||||
输出:【】【怎么添加特征段】
|
||||
|
||||
输入:西藏造价软件Z1
|
||||
输出:【西藏造价软件Z1】【】
|
||||
|
||||
请根据以下用户问题进行规范表达,不要有任何解释说明:
|
||||
|
||||
软件名称:{soft_name}
|
||||
用户问题:{query}
|
||||
|
||||
结构化问题:
|
||||
""".strip()
|
||||
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | deep_v3 | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
|
||||
def mutil_text_rewrite():
|
||||
PromptTemplate = """
|
||||
你是一个智能问答重写助手,根据聊天记录进行结构化、规范表达的重写,符合以下范式:
|
||||
1. 【软件名】【其他】
|
||||
|
||||
# 例子
|
||||
输入:
|
||||
user: 西藏造价软件Z1
|
||||
assistant: 好的,具体软件是【西藏造价软件Z1】, 请补充具体的需求
|
||||
user: 进行费用统计
|
||||
输出:【西藏Z1软件】【进行费用统计】
|
||||
|
||||
请根据以下用户问题进行规范表达,不要有任何解释说明:
|
||||
|
||||
聊天记录:{history}
|
||||
|
||||
结构化问题:
|
||||
""".strip()
|
||||
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate)
|
||||
|
||||
Chain = Prompt | deep_v3 | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
|
||||
def software_judge():
|
||||
# 费用计算另处理
|
||||
PromptTemplate1 = """
|
||||
你根据用户输入的线索来选择返回输出:
|
||||
|
||||
1. 西藏造价软件Z1
|
||||
2. 新型储能计价通C1
|
||||
3. 技改检修计价通T1
|
||||
4. 博微配网工程计价通D3软件
|
||||
|
||||
用户输入:"{query}"
|
||||
|
||||
输出格式:str类型
|
||||
|
||||
注意:
|
||||
1. 你的回复答案一定是[西藏造价软件Z1、新型储能计价通C1、技改检修计价通T1、博微配网工程计价通D3软件]之一,不要有其他回答,不要解释说明
|
||||
"""
|
||||
|
||||
Prompt = ChatPromptTemplate.from_template(PromptTemplate1)
|
||||
|
||||
Chain = Prompt | deep_v3 | StrOutputParser()
|
||||
# Chain = Prompt | llm | StrOutputParser()
|
||||
|
||||
return Chain
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user