Skip to content

Commit 9d9a1ef

Browse files
author
珈炆
committed
add more intentions
Signed-off-by: 珈炆 <chenguowang.cgw@antgroup.com>
1 parent 2a61cc9 commit 9d9a1ef

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

muagent/base_configs/prompts/intention_template_prompt.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Union, Optional, Sequence
22
from dataclasses import dataclass
3-
3+
## todo here
44

55
RECOGNIZE_INTENTION_PROMPT = """你是一个任务决策助手,能够将理解用户意图并决策采取最合适的行动,尽可能地以有帮助和准确的方式回应人类,
66
使用 JSON Blob 来指定一个返回的内容,提供一个 action(行动)。
@@ -156,6 +156,18 @@ def get_intention_prompt(
156156
description='用户的主要目的是获取信息而非执行任务(比如:怎么向银行申请贷款),或只是简单闲聊。',
157157
name='询问'
158158
)
159+
INTENTION_BACKGROUND = IntentionInfo(
160+
description='用户的主要目的是获取某个问题或方案的背景知识,规则以及流程介绍等。',
161+
name='背景查询'
162+
)
163+
INTENTION_COST = IntentionInfo(
164+
description='用户的主要目的是获取完成整个解决方案或者是完成下一步预估需要花费的时间、金钱等。',
165+
name='成本预估'
166+
)
167+
INTENTION_NEXTSTEPRESULT = IntentionInfo(
168+
description='用户的主要目的是获取执行某个方案的特定步骤后预期得到的结果。',
169+
name='下一步结果查询'
170+
)
159171
INTENTION_NOMATCH = IntentionInfo(
160172
description='与上述意图都不匹配,属于其他类型的询问意图。'
161173
)
@@ -171,13 +183,16 @@ def get_intention_prompt(
171183
}
172184
)
173185

174-
INTENTIONS_CONSULT_WHICH = (INTENTION_ALLPLAN, INTENTION_NEXTSTEP, INTENTION_CHAT)
186+
INTENTIONS_CONSULT_WHICH = (INTENTION_ALLPLAN, INTENTION_NEXTSTEP, INTENTION_CHAT, INTENTION_BACKGROUND, INTENTION_COST, INTENTION_NEXTSTEPRESULT)
175187
CONSULT_WHICH_PROMPT = get_intention_prompt(
176188
intentions=INTENTIONS_CONSULT_WHICH,
177189
examples={
178190
'如何组织一次活动?': INTENTION_ALLPLAN,
179191
'系统升级的整个流程是怎样的?': INTENTION_ALLPLAN,
180192
'为什么我没有收到红包?请告诉我方案': INTENTION_ALLPLAN,
181-
'听说你们采用了新工具,能讲讲它的特点吗?': INTENTION_CHAT
193+
'听说你们采用了新工具,能讲讲它的特点吗?': INTENTION_CHAT,
194+
'请问下狼人杀游戏中猎人的主要职责是什么?': INTENTION_BACKGROUND,
195+
'整个流程大概还有多长时间能够结束?' : INTENTION_COST,
196+
'执行完该操作后预期能够得到什么结果?' : INTENTION_NEXTSTEPRESULT
182197
}
183198
)

muagent/service/ekg_inference/intention_router.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ def get_intention_consult_which(self, query: str, agent=None, root_node_id: Opti
287287
agent = agent if agent else self.agent
288288
query_consult_which = itp.CONSULT_WHICH_PROMPT.format(query=query)
289289
ans = agent.predict(query_consult_which)
290+
logger.info("ans is " + str(ans))
290291

291292
ans = [int(x) - 1 for x in re.findall('\d+', ans) if 0 < int(x) <= len(itp.INTENTIONS_CONSULT_WHICH)]
292293
if ans and itp.INTENTIONS_CONSULT_WHICH[ans[0]] is not itp.INTENTION_CHAT:

0 commit comments

Comments
 (0)