提示词
import warnings
warnings.filterwarnings("ignore")
from langchain import PromptTemplate,LLMChain
from llm import ChatGLM
# 简单的问题模板
template = """问题: {question}
答案: """
prompt = PromptTemplate(
template=template,
input_variables=['question']
)
# user question
question = "中国的首都是哪里?"
print(prompt)
llm = ChatGLM(model_path="../chatglm2-6B/chatglm2-6b")
llm.load_model()
print("ok")
llm_chain = LLMChain(prompt=prompt,llm=llm)
print(llm_chain.run(question))
# 多个问题链
qs = [
{'question': "姚明是谁?"},
{'question': "美国的总统是谁?"},
{'question': "福州今天的天气如何?"},
{