可以用 router_chain 做分類問題的AI #16
leechiuhui
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
在機器學習領域,「MoE」指的是一種模型架構,它結合了多個「專家」子模型,每個子模型專注於處理特定的任務。
這種架構可以提高模型的效率和效能,特別是在處理複雜的任務時。
簡單的說,就是讓更擅長的模型去處理更專業的問題。
def route(info):
if 'mathematics' in info['key_topic'].lower():
return math_prompt
elif 'physics' in info['key_topic'].lower():
return physics_prompt
else:
return general_prompt
Mathematics
math_template = '''你是一位非常聰明的數學教授,很擅長回答數學問題。
你能夠將難題分解成各個小問題部分,回答小問題後將它們組合起來回答更廣泛的問題。
問題如下:
{param_ques}'''
math_prompt = PromptTemplate.from_template(math_template)
Physics
physics_template = '''你是一位非常聰明的物理學教授,很擅長回答物理問題。
你擅長以簡潔易懂的方式回答有關物理的問題。當你不知道某個問題的答案時,你就承認你不知道。
問題如下:
{param_ques}'''
physics_prompt = PromptTemplate.from_template(physics_template)
General Assistant
general_template = '''你是一個聰明的全能助手,請盡可能準確地回答問題。
問題如下:
{param_ques}'''
general_prompt = PromptTemplate.from_template(general_template)
Beta Was this translation helpful? Give feedback.
All reactions