本文展示一个dify+searxng的组合工作流,制作一个搜索大师的工作流,这个搜索大师能干什么呢?主要是:
1、将输入的问题拆分成多个相识的问题。 2、将拆分的问题挨个使用searxng进行多样化搜索 2、把搜索结果进行聚合 3、在搜索结果的基础上让ai帮我们总结,提炼核心。
工作流类型:chatflow
工作流dsl:
app: description: '' icon: 🌐 icon_background: '#E4FBCC' mode: advanced-chat name: 搜索大师 use_icon_as_answer_icon: false dependencies: - current_identifier: null type: marketplace value: marketplace_plugin_unique_identifier: langgenius/searxng:0.0.2@f7b89266ad7194a5574223198ade08a8f3841857d907ebdc4813fa4c2fba9381 - current_identifier: null type: marketplace value: marketplace_plugin_unique_identifier: langgenius/siliconflow:0.0.8@217f973bd7ced1b099c2f0c669f1356bdf4cc38b8372fd58d7874f9940b95de3 kind: app version: 0.1.5 workflow: conversation_variables: [] 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 fileUploadConfig: audio_file_size_limit: 50 batch_count_limit: 5 file_size_limit: 15 image_file_size_limit: 10 video_file_size_limit: 100 workflow_file_upload_limit: 10 image: enabled: false number_limits: 3 transfer_methods: - local_file - remote_url number_limits: 3 opening_statement: '' retriever_resource: enabled: false 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: isInIteration: false sourceType: start targetType: llm id: 1719593592357-source-1719759357501-target selected: false source: '1719593592357' sourceHandle: source target: '1719759357501' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: llm targetType: code id: 1719759357501-source-1719838886987-target selected: false source: '1719759357501' sourceHandle: source target: '1719838886987' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: code targetType: iteration id: 1719838886987-source-1719840515773-target selected: false source: '1719838886987' sourceHandle: source target: '1719840515773' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: iteration targetType: template-transform id: 1719878483248-source-1719840940932-target selected: false source: '1719878483248' sourceHandle: source target: '1719840940932' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: template-transform targetType: llm id: 1719840940932-source-1719932888279-target selected: false source: '1719840940932' sourceHandle: source target: '1719932888279' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: iteration targetType: code id: 1719840515773-source-1719933634159-target selected: false source: '1719840515773' sourceHandle: source target: '1719933634159' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: code targetType: iteration id: 1719933634159-source-1719878483248-target selected: false source: '1719933634159' sourceHandle: source target: '1719878483248' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false sourceType: llm targetType: answer id: 1719932888279-source-answer-target selected: false source: '1719932888279' sourceHandle: source target: answer targetHandle: target type: custom zIndex: 0 - data: isInIteration: true iteration_id: '1719840515773' sourceType: iteration-start targetType: tool id: 1719840515773start0-source-1720362263119-target selected: false source: 1719840515773start0 sourceHandle: source target: '1720362263119' targetHandle: target type: custom zIndex: 1002 - data: isInIteration: true iteration_id: '1719878483248' sourceType: http-request targetType: llm id: 1735721206584-source-1735721255006-target source: '1735721206584' sourceHandle: source target: '1735721255006' targetHandle: target type: custom zIndex: 1002 - data: isInIteration: true iteration_id: '1719878483248' sourceType: iteration-start targetType: http-request id: 1719878483248start1-source-1735721206584-target source: 1719878483248start1 sourceHandle: source target: '1735721206584' targetHandle: target type: custom zIndex: 1002 nodes: - data: desc: '' selected: false title: Start type: start variables: [] height: 54 id: '1719593592357' position: x: 30 y: 388.5 positionAbsolute: x: 30 y: 388.5 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: answer: '{{#1719932888279.text#}}' desc: '' selected: false title: Answer type: answer variables: [] height: 105 id: answer position: x: 3619 y: 388.5 positionAbsolute: x: 3619 y: 388.5 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: context: enabled: true variable_selector: - sys - query desc: '' model: completion_params: {} mode: chat name: Qwen/Qwen2.5-7B-Instruct provider: langgenius/siliconflow/siliconflow prompt_template: - id: 455a5f0d-bbba-479a-b3c2-1eefa938894a role: system text: "You are a helpful assistant that helps the user to ask related questions,\ \ based on question and the related contexts. \n\nPlease make sure that\ \ specifics, like events, names, locations, are included in follow up\ \ questions so they can be asked standalone. For example, if the original\ \ question asks about \"the Manhattan project\", in the follow up question,\ \ do not just say \"the project\", but use the full name \"the Manhattan\ \ project\". Your related questions must be in the same language as the\ \ original question." - id: 6ba785ec-0bba-4a19-8a6d-63dbeacce7d2 role: user text: "Here is the question: {{#sys.query#}}\n\nUnderstand the question\ \ first, then identify worthwhile topics that can be follow-ups, provide\ \ 3 questions, each question no longer than 20 words. \nDo NOT repeat\ \ the original question. the output language MUST same as ‘ {{#context#}}\ \ ‘ and do NOT return any translation. " selected: false title: 问题分解器 type: llm variables: [] vision: enabled: false height: 96 id: '1719759357501' position: x: 334.5929876945846 y: 388.5 positionAbsolute: x: 334.5929876945846 y: 388.5 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: code: "\ndef main(arg1: str) -> dict:\n questions = arg1.split('\\n')\n\ \ return {\n \"result\": questions,\n }\n" code_language: python3 desc: '' outputs: result: children: null type: array[string] selected: false title: 问题数组 type: code variables: - value_selector: - '1719759357501' - text variable: arg1 height: 54 id: '1719838886987' position: x: 638 y: 388.5 positionAbsolute: x: 638 y: 388.5 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: desc: '' error_handle_mode: terminated height: 247 is_parallel: false iterator_selector: - '1719838886987' - result output_selector: - '1720362263119' - json output_type: array[string] parallel_nums: 10 selected: false startNodeType: tool start_node_id: 1719840515773start0 title: 循环搜索 type: iteration width: 377 height: 247 id: '1719840515773' position: x: 943.6915776724429 y: 388.5 positionAbsolute: x: 943.6915776724429 y: 388.5 selected: false sourcePosition: right targetPosition: left type: custom width: 377 zIndex: 1 - data: desc: '' selected: false template: '{{ arg1 }} ' title: 聚合内容 type: template-transform variables: - value_selector: - '1719878483248' - output variable: arg1 height: 54 id: '1719840940932' position: x: 3011.7993474263017 y: 388.5 positionAbsolute: x: 3011.7993474263017 y: 388.5 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: desc: '' error_handle_mode: terminated height: 377 is_parallel: false iterator_selector: - '1719933634159' - result output_selector: - '1735721255006' - text output_type: array[string] parallel_nums: 10 selected: false startNodeType: http-request start_node_id: 1719878483248start1 title: 整理收集结果 type: iteration width: 1286 height: 377 id: '1719878483248' position: x: 1577.4861397281613 y: 344.5358915534005 positionAbsolute: x: 1577.4861397281613 y: 344.5358915534005 selected: false sourcePosition: right targetPosition: left type: custom width: 1286 zIndex: 1 - data: context: enabled: false variable_selector: [] desc: '' memory: query_prompt_template: '{{#sys.query#}}{{#1719759357501.text#}}' role_prefix: assistant: '' user: '' window: enabled: false size: 50 model: completion_params: {} mode: chat name: Qwen/Qwen2.5-7B-Instruct provider: langgenius/siliconflow/siliconflow prompt_template: - id: fd1a7c6d-67ae-4124-ad91-65fe8868c4ab role: system text: 'You are a large language AI assistant built by winson. Your answer must be correct, accurate and written by an expert using an unbiased and professional tone. ' - id: 989185b9-19fb-486e-b430-b9c379b532b9 role: user text: "<Task>\nDo a general overview style summary to the following text\ \ in Chinese and in markdown format, please output the url as the reference\ \ if have. \n<Text to be summarized>\n{{#1719840940932.output#}}\n<Summary>" selected: false title: LLM 4 type: llm variables: [] vision: enabled: false height: 90 id: '1719932888279' position: x: 3315 y: 388.5 positionAbsolute: x: 3315 y: 388.5 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: code: "def main(arg2):\n urls = []\n for item in arg2: # 直接迭代arg2中的每个元素(这里假设arg2是一个列表的列表)\n\ \ if \"url\" in item:\n urls.append(item[\"url\"])\n \ \ return {\n \"result\": urls[:10] # 返回最多前10个URL\n }\n" code_language: python3 desc: '' outputs: result: children: null type: array[string] selected: false title: URL 收集器 type: code variables: - value_selector: - '1719840515773' - output variable: arg2 height: 54 id: '1719933634159' position: x: 1379 y: 388.5 positionAbsolute: x: 1379 y: 388.5 selected: false sourcePosition: right targetPosition: left type: custom width: 244 - data: desc: '' isInIteration: true isIterationStart: true iteration_id: '1719840515773' provider_id: searxng provider_name: searxng provider_type: builtin selected: false title: SearXNG 搜索 tool_configurations: num_results: 1 result_type: link search_type: general tool_label: SearXNG 搜索 tool_name: searxng_search tool_parameters: query: type: mixed value: '{{#1719840515773.item#}}' type: tool extent: parent height: 142 id: '1720362263119' parentId: '1719840515773' position: x: 117 y: 87 positionAbsolute: x: 1060.691577672443 y: 475.5 selected: false sourcePosition: right targetPosition: left type: custom width: 244 zIndex: 1001 - data: desc: '' isInIteration: true selected: false title: '' type: iteration-start draggable: false height: 48 id: 1719840515773start0 parentId: '1719840515773' position: x: 24 y: 68 positionAbsolute: x: 967.6915776724429 y: 456.5 selectable: false sourcePosition: right targetPosition: left type: custom-iteration-start width: 44 zIndex: 1002 - data: desc: '' isInIteration: true selected: false title: '' type: iteration-start draggable: false height: 48 id: 1719878483248start1 parentId: '1719878483248' position: x: 24 y: 68 positionAbsolute: x: 1601.4861397281613 y: 412.5358915534005 selectable: false sourcePosition: right targetPosition: left type: custom-iteration-start width: 44 zIndex: 1002 - data: authorization: config: null type: no-auth body: data: [] type: none desc: '' headers: '' isInIteration: true iteration_id: '1719878483248' method: get params: '' retry_config: max_retries: 3 retry_enabled: true retry_interval: 100 selected: true timeout: max_connect_timeout: 0 max_read_timeout: 0 max_write_timeout: 0 title: HTTP 请求 2 type: http-request url: https://r.jina.ai/{{#1719878483248.item#}} variables: [] extent: parent height: 139 id: '1735721206584' parentId: '1719878483248' position: x: 245.97478863893912 y: 150.75067962958838 positionAbsolute: x: 1823.4609283671005 y: 495.2865711829889 selected: true sourcePosition: right targetPosition: left type: custom width: 244 zIndex: 1002 - data: context: enabled: false variable_selector: [] desc: '' isInIteration: true iteration_id: '1719878483248' model: completion_params: {} mode: chat name: Qwen/Qwen2.5-7B-Instruct provider: langgenius/siliconflow/siliconflow prompt_template: - id: ee1d16e1-8e25-4a62-a37b-737bd96ed261 role: system text: 'Please provide a comprehensive summary of the given content {{#1735721206584.body#}}, focusing on: 1. Main ideas and key points 2. Supporting evidence and examples 3. Important conclusions 4. Practical implications Format requirements: - Keep it concise and clear - Use bullet points where appropriate - Highlight critical information - Maintain logical flow Please limit the summary to [number] words/paragraphs.' selected: false title: LLM 3 type: llm variables: [] vision: enabled: false extent: parent height: 96 id: '1735721255006' parentId: '1719878483248' position: x: 762.2202360862525 y: 175.6293151651082 positionAbsolute: x: 2339.706375814414 y: 520.1652067185087 selected: false sourcePosition: right targetPosition: left type: custom width: 244 zIndex: 1002 viewport: x: -4576.567611286098 y: -240.70003116203407 zoom: 1.251020478825474
最后,比如我们搜索智汇技术网站
等待片刻即可:
等待片刻后可以看到他进行了2次总结,虽然结果不怎么样,但是这一套工作流的组合还是可以学习下,主要涉及到:
1、llm配置 2、循环 3、searxng 4、python代码 5、jina转换 6、聚合
整个一套工作流的每一个组件学习完之后差不多就能对dify工作流的使用非常熟练了。
还没有评论,来说两句吧...