返回顶部
热门问答 更多热门问答
技术文章 更多技术文章

使用Dify为DeepSeek-R1添加多模态功能

[复制链接]
链载Ai 显示全部楼层 发表于 3 小时前 |阅读模式 打印 上一主题 下一主题
在DeepSeek-R1引发全球AI领域关注之际,其突破性的推理能力已通过多项测试得到验证:模型不仅将AIME数学竞赛准确率从15.6%提升至86.7%,更在Codeforces编程竞赛中超越96.3%人类参与者,展现出真实的数学直觉与迁移学习能力。然而作为纯文本模型,其官方版本存在多模态能力缺失与功能互斥的局限。
我选择通过Dify构建智能编排层:以DeepSeek-R1作为推理引擎,驱动更强大模型的多模态能力,实现文件解析与网络连接的协同运作。
在 Dify 中创建一个空白应用,选择 Chatflow 类型,打开工作区点击右上角的“功能”按钮,打开“文件上传”功能,勾选“文档”和“图片”类型。
按照上图编排工作流,核心思路就是解析文档和图片内容,交给 DeepSeek-R1 只生成推理内容,再把文档或图片以及解析到的内容和 R1 推理全部传给 Gemini 多模态模型,最终由 Gemini 来回答用户问题。
DeepSeek-R1 思考节点
DeepSeek-R1 扮演“优等生”的角色,专注于问题分解和逻辑推理。其核心任务是输出完整的思考过程,而不是直接提供答案。
在编写系统提示时,建议编写结构化提示,例如使用 XML 格式,这可以增强模型对问题任务的分解。
提示词如下:
<Role>You are an LLM with reasoning capabilities.Unlike other LLMs, you can output your complete thinkingprocess.</Role><Task>Your task is to assist other LLMs that lack reasoning capabilities.You need to output complete thinking processesforother LLMs based on user questions.<Steps>"Step 1":"Receive questions from users.""Step 2":"Conduct deep reasoning and analysis on user questions.""Step 3":"Elaborate on the reasoning process and logic, ensuring the process is complete and easy to understand.""Step 4":"Output the complete reasoning process, no final answer needed."</Steps></Task><Limitations>Donot output the final answer, only output the thinkingprocess.Donot explain your own capabilities or limitations.</Limitations>
Inaddition, we need to adjust the user input content, adding the content from the doc extractor:<User Query>{{Start}}</User Query><File>{{text}}</File>
Gemini 多模态节点
Gemini 是一种具有强大视觉能力的多模态模型,依靠 R1 推理框架结合多模态数据并生成最终答案。其优势在于图像解析和结果优化。注意需要在此节点中启用LLM的视觉功能以获得解析图片和文档的能力。
提示词如下:
<Role>YouareanLLMthatexcelsatlearning.</Role><Task>Youneedtolearnfromothers'thinkingprocessesaboutproblems,enhanceyourresultswiththeirthinking,andthenprovideyouranswer.<Steps>"Step1":"ReceivethinkingprocessfromDeepSeek-R1model.""Step2":"CarefullystudyandunderstandDeepSeek-R1'sreasoninglogicandsteps.""Step3":"GeneratefinalanswerbasedonDeepSeek-R1'sthinking,combinedwithimagecapabilities.""Step4":"Outputthefinalanswer,noneedtoexplainthethinkingprocess."</Steps></Task><Limitations>DonotrepeatDeepSeek-R1'sthinkingprocess,onlyoutputthefinalanswer.Donotexplainyourowncapabilitiesorlearningprocess.Ensuretheanswerisaccurateandrelevanttothequestion.</Limitations>

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

链载AI是专业的生成式人工智能教程平台。提供Stable Diffusion、Midjourney AI绘画教程,Suno AI音乐生成指南,以及Runway、Pika等AI视频制作与动画生成实战案例。从提示词编写到参数调整,手把手助您从入门到精通。
  • 官方手机版

  • 微信公众号

  • 商务合作

  • Powered by Discuz! X3.5 | Copyright © 2025-2025. | 链载Ai
  • 桂ICP备2024021734号 | 营业执照 | |广西笔趣文化传媒有限公司|| QQ