升级新库
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
from langchain_core.prompts import PromptTemplate
|
||||
|
||||
from config.llm import llm
|
||||
from langchain.prompts import PromptTemplate
|
||||
|
||||
chatPrompt = PromptTemplate(
|
||||
input_variables=["aiRole", "history", "userInput"],
|
||||
template = """
|
||||
template="""
|
||||
你的用户画像为:{aiRole}。
|
||||
你需要基于你的角色性格,使用中文回答用户。
|
||||
|
||||
@@ -15,13 +15,12 @@ chatPrompt = PromptTemplate(
|
||||
{userInput}
|
||||
|
||||
最后,请注意,不要编造数据,不知道就说不知道,现在,请生成你的回复:
|
||||
"""
|
||||
""",
|
||||
)
|
||||
chatChain = chatPrompt | llm
|
||||
|
||||
def get_chat_response(aiRole: str,history: str, userInput: str) -> str:
|
||||
return chatChain.invoke({
|
||||
"aiRole": aiRole,
|
||||
"history": history,
|
||||
"userInput": userInput
|
||||
})
|
||||
|
||||
def get_chat_response(aiRole: str, history: str, userInput: str) -> str:
|
||||
return chatChain.invoke(
|
||||
{"aiRole": aiRole, "history": history, "userInput": userInput}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user