MCPcopy Create free account
hub / github.com/SmartFlowAI/TheGodOfCookery / load_chain

Function load_chain

eval/interface.py:75–97  ·  view source on GitHub ↗
(llm, verbose=False)

Source from the content-addressed store, hash-verified

73
74
75def load_chain(llm, verbose=False):
76 # 加载检索器
77 retriever = load_retriever()
78
79 # RAG对话模板
80 qa_template = """先对上下文进行内容总结,再使上下文来回答用户的问题。总是使用中文回答。
81可参考的上下文:
82···
83{context}
84···
85问题: {question}
86如果给定的上下文无法让你做出回答,请根据你自己所掌握的知识进行回答。
87有用的回答:"""
88 QA_CHAIN_PROMPT = PromptTemplate(input_variables=["context", "question"],
89 template=qa_template)
90
91 # 单轮对话RAG问答链
92 qa_chain = RetrievalQA.from_chain_type(llm=llm,
93 chain_type="stuff",
94 chain_type_kwargs={"prompt": QA_CHAIN_PROMPT, "verbose": verbose},
95 retriever=retriever)
96
97 return qa_chain
98
99
100def load_model():

Callers 1

evaluate_modelFunction · 0.90

Calls 1

load_retrieverFunction · 0.70

Tested by

no test coverage detected