任务拆解
通过工作流实现将复杂任务进行拆解成子问题,逐步解答子问题,最后聚合答案得到最终答案
工作流图谱
YAML 源码
app:
description: 通过工作流实现将复杂任务进行拆解成子问题,逐步解答子问题,最后聚合答案得到最终答案
icon: seedling
icon_background: '#D3F8DF'
mode: advanced-chat
name: 任务拆解
use_icon_as_answer_icon: true
kind: app
version: 0.1.2
workflow:
conversation_variables:
- description: 记录迭代过程中的数据,在循环过程中能看见前面的结果
id: d2f1ac13-3c10-44ea-8cf0-dbd752577b6a
name: subtaskRet
value: []
value_type: array[object]
environment_variables: []
features:
file_upload:
allowed_file_extensions:
- .JPG
- .JPEG
- .PNG
- .GIF
- .WEBP
- .SVG
allowed_file_types:
- image
allowed_file_upload_methods:
- local_file
- remote_url
enabled: false
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
number_limits: 3
opening_statement: ''
retriever_resource:
enabled: true
sensitive_word_avoidance:
enabled: false
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
graph:
edges:
- data:
sourceType: start
targetType: llm
id: 1728709838888-llm
selected: false
source: '1728709838888'
sourceHandle: source
target: llm
targetHandle: target
type: custom
- data:
isInIteration: false
sourceType: llm
targetType: parameter-extractor
id: llm-source-1728730008819-target
selected: false
source: llm
sourceHandle: source
target: '1728730008819'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: true
iteration_id: '1728709933523'
sourceType: iteration-start
targetType: code
id: 1728709933523start-source-1728730342984-target
selected: false
source: 1728709933523start
sourceHandle: source
target: '1728730342984'
targetHandle: target
type: custom
zIndex: 1002
- data:
isInIteration: true
iteration_id: '1728709933523'
sourceType: code
targetType: llm
id: 1728730342984-source-1728730552797-target
selected: false
source: '1728730342984'
sourceHandle: source
target: '1728730552797'
targetHandle: target
type: custom
zIndex: 1002
- data:
isInIteration: false
sourceType: llm
targetType: answer
id: 1728731078833-source-answer-target
selected: false
source: '1728731078833'
sourceHandle: source
target: answer
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: true
iteration_id: '1728709933523'
sourceType: llm
targetType: code
id: 1728730552797-source-1728905920547-target
selected: false
source: '1728730552797'
sourceHandle: source
target: '1728905920547'
targetHandle: target
type: custom
zIndex: 1002
- data:
isInIteration: true
iteration_id: '1728709933523'
sourceType: code
targetType: assigner
id: 1728905920547-source-1728903932962-target
selected: false
source: '1728905920547'
sourceHandle: source
target: '1728903932962'
targetHandle: target
type: custom
zIndex: 1002
- data:
isInIteration: false
sourceType: iteration
targetType: code
id: 1728709933523-source-1728906342693-target
selected: false
source: '1728709933523'
sourceHandle: source
target: '1728906342693'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: llm
id: 1728906342693-source-1728731078833-target
selected: false
source: '1728906342693'
sourceHandle: source
target: '1728731078833'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: parameter-extractor
targetType: assigner
id: 1728730008819-source-1728907440113-target
selected: false
source: '1728730008819'
sourceHandle: source
target: '1728907440113'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: assigner
targetType: iteration
id: 1728907440113-source-1728709933523-target
selected: false
source: '1728907440113'
sourceHandle: source
target: '1728709933523'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: 开始
type: start
variables: []
height: 54
id: '1728709838888'
position:
x: 30
y: 479
positionAbsolute:
x: 30
y: 479
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
frequency_penalty: 0.3
presence_penalty: 0.2
temperature: 0.5
top_p: 0.85
mode: chat
name: gpt-4o-2024-08-06
provider: openai
prompt_template:
- edition_type: basic
id: e9dc2802-a5f3-4e1c-bae6-92a80e0e3634
role: system
text: '# Role:问题拆解专家
## Goals:
对于用户提出的问题进行拆解,将复杂问题转换为多个字问题或步骤,便于后续解答
## Constrains:
1. 不要直接给出答案
2. 拆解步骤要保证逻辑严谨,逐步推导
3. 拆解完成后即结束对话, 不会询问是否有其它问题
4. 如果是简单问题,不要硬拆,按1个步骤处理
## Skills:
1. 具有强大的问题分析能力
2. 擅长将复杂问题拆解为简单子问题或步骤
## Workflows:
1. 分析问题,提取问题的最终目的
2. 分解问题为简单子问题或步骤。为每一个解题步骤提供简单清晰的名称,帮助理解解题过程的结构。对每个步骤的任务进行简洁描述,确保问题解决的路径逐步清晰。
3. 按照格式输出
## OutputFormat
"""
[{"step":"步骤名称","desc":"任务描述"}]
"""
## Example1
### input
2020年诺贝尔奖获得者的年龄
### output
"""
[{"step":"确定2020年诺贝尔奖的获奖者","desc":"我们需要查找2020年获得诺贝尔奖的所有获奖者的名单"},{"step":"收集获奖者的出生年份","desc":"从确定的获奖者名单中,收集每位获奖者的出生年份,以便后续计算他们的年龄。"},{"step":"计算每位获奖者的年龄","desc":"根据当前年份减去每位获奖者的出生年份,计算出他们各自的年龄。"}]
"""
## Example2
### input
9.11和9.8 这两个数字谁更大?
### output
"""
[{"step":"获得整数和小数部分","desc":"分别获取数字的整数部分和小数部分"},{"step":"比较整数部分","desc":"按整数比较大小"},{"step":"比较小数部分","desc":"按小数比较大小"}]
"""
'
- id: 4483f953-2d33-49e4-9bf5-14de82b86d71
role: user
text: '{{#sys.query#}}'
selected: false
title: 问题拆解
type: llm
variables: []
vision:
configs:
detail: high
enabled: false
height: 98
id: llm
position:
x: 334
y: 479
positionAbsolute:
x: 334
y: 479
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
answer: '------
## 最终结论
{{#1728731078833.text#}}'
desc: ''
selected: false
title: 直接回复
type: answer
variables: []
height: 119
id: answer
position:
x: 765.5049840078232
y: 1260.9163854849558
positionAbsolute:
x: 765.5049840078232
y: 1260.9163854849558
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
desc: ''
height: 558
iterator_selector:
- '1728730008819'
- step_array
output_selector:
- '1728730552797'
- text
output_type: array[string]
selected: false
start_node_id: 1728709933523start
title: 迭代
type: iteration
width: 1359
height: 558
id: '1728709933523'
position:
x: -24.890530274573962
y: 653.6339946135099
positionAbsolute:
x: -24.890530274573962
y: 653.6339946135099
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 1359
zIndex: 1
- data:
desc: ''
isInIteration: true
selected: false
title: ''
type: iteration-start
draggable: false
height: 48
id: 1728709933523start
parentId: '1728709933523'
position:
x: 24
y: 68
positionAbsolute:
x: -0.8905302745739618
y: 721.6339946135099
selectable: false
sourcePosition: right
targetPosition: left
type: custom-iteration-start
width: 44
zIndex: 1002
- data:
desc: ''
instruction: '提取内容中的步骤数组,按如下格式输出:
[ { "step":"步骤名称", "desc":"任务描述" }, { "step":"步骤名称", "desc":"任务描述" }, ...
]'
model:
completion_params:
temperature: 0.7
mode: chat
name: gpt-4o-mini
provider: openai
parameters:
- description: 提取内容中的步骤数组
name: step_array
required: true
type: array[object]
query:
- llm
- text
reasoning_mode: prompt
selected: false
title: 问题拆解后参数提取
type: parameter-extractor
variables: []
vision:
configs:
detail: high
variable_selector:
- sys
- files
enabled: false
height: 98
id: '1728730008819'
position:
x: 638
y: 479
positionAbsolute:
...(过长已截断)