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

详细版教程|使用 Higress AI 网关,4步实现 DeepSeek 联网搜索功能

[复制链接]
链载Ai 显示全部楼层 发表于 3 小时前 |阅读模式 打印 上一主题 下一主题

为什么公司部署的 DeepSeek 的内容生成效果不如 DeepSeek 官方的?


一是看是否是满血版,二是看是否支持了联网搜索,三是看联网搜索是否仅能获取网页标题、摘要、关键词而非全文。



ingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);min-height: 24px;line-height: 2em;visibility: visible;box-sizing: border-box !important;overflow-wrap: break-word !important;">Step.0 配置 DeepSeek 的 API Key

可能你在安装Higress 时没有填写 DeepSeek 的 API Key,那么可以在这里进行配置。


ingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);min-height: 24px;line-height: 2em;visibility: visible;box-sizing: border-box !important;overflow-wrap: break-word !important;">Step.1 配置搜索引擎 API 域名

首先在 Higress 控制台,通过创建服务来源方式配置各个搜索引擎的域名:

google 搜索 API 的域名是:customsearch.googleapis.com


bing 搜索 API 的域名是:api.bing.microsoft.com


夸克搜索 API 的域名是:cloud-iqs.aliyuncs.com


Arxiv API 的域名是:export.arxiv.org


配置好后,还要申请对应的 API Key,这里以夸克搜索的 API key 申请为例, Google 和 Bing 不做赘述(网上资料也比较多),Arxiv 是免费的不需要 API Key。


首先需要有个阿里云账号,然后在阿里云控制台搜索 IQS,进入 IQS 的控制台生成 API Key 即可:

具体可以查看 IQS 的文档:https://help.aliyun.com/document_detail/2870227.html


ingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);min-height: 24px;line-height: 2em;visibility: visible;box-sizing: border-box !important;overflow-wrap: break-word !important;">Step.2 配置 AI Search插件

2.1.0 版本之前的 Higress 需要通过自定义插件的方式,导入 AI Search 插件:

注意插件OCI 镜像地址填写:higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-search:latest


可以确保使用最新版本的 AI Search 插件,如果希望使用稳定版本,将 tag 改为1.0.0即可。


执行阶段选择默认,执行优先级填写大于100的任意值即可(这样让 AI Search 插件在转发到 LLM 供应商之前的时刻执行, 对 prompt 进行修改)。


添加完插件后,进行相应配置:


配置示例如下:
    needReference:true#为true时会在结果中附带网页引用信息promptTemplate:|#可以不用配置模版,使用内置的也可以#Thefollowingcontentisbasedonsearchresultsfromtheuser-submittedquery:{search_results}InthesearchresultsIprovide,eachresultisformattedas[webpageXbegin]...[webpageXend],whereXrepresentstheindexnumberofeacharticle.Pleasecitethecontextattheendofthesentenceswhereappropriate.Useaformatofcitationnumbe]intheanswerforcorrespondingparts.Ifasentenceisderivedfrommultiplecontexts,listallrelevantcitationnumbers,suchas[3][5],andensurenottoclusterthecitationsattheend;instead,listtheminthecorrespondingpartsoftheanswer.Whenresponding,pleasepayattentiontothefollowing:-Today’sdateinBeijingtimeis:{cur_date}.-Notallcontentfromthesearchresultsiscloselyrelatedtotheuser'squestion.Youneedtodiscernandfilterthesearchresultsbasedonthequestion.-Forlisting-typequestions(e.g.,listingallflightinformation),trytokeeptheanswertowithin10pointsandinformtheuserthattheycancheckthesearchsourceforcompleteinformation.Prioritizeprovidingthemostcomprehensiveandrelevantms;donotvolunteerinformationmissingfromthesearchresultsunlessnecessary.-Forcreativequestions(e.g.,writingapaper),besuretociterelevantreferencesinthebodyparagraphs,suchas[3][5],ratherthanonlyattheendofthearticle.Youneedtointerpretandsummarizetheuser'stopicrequirements,choosetheapprateformat,fullyutilizesearchresults,extractcrucialinformation,andgenerateanswersthatmeetuserrequirements,withdeepthought,creativity,andprofessionalism.Thelengthofyourcreationshouldbeextendedasmuchaspossible,hypothesizetser'sintentforeachpoint,providingasmanyanglesaspossible,ensuringsubstantialinformation,anddetaileddiscussion.-Iftheresponseislengthy,trytostructurethesummaryintoparagraphs.Ifrespondingwithpoints,trytokeepitwithin5pointsandconsolidaterelatedcontent.-ForobjectiveQ&A,iftheanswerisveryshort,youcanappropriatelyaddoneortworelatedsentencestoenrichthecontent.-Youneedtochooseasuitableandaestheticallypleasingresponseformatbasedontheuser’srequirementsandanswercontenttoensurehighreadability.-Youranswersshouldsynthesizemultiplerelevantwebpagestorespondandshouldnotrepeatedlyquoteasinglewebpage.-Unlesstheuserrequestsotherwise,respondinthesamelanguagethequestionwasasked.#Theuser’smessageis:{question}searchFrom:#下面是配置一个搜索引擎选择列表,可以仅配置你需要的引擎,不用都配上-type:quarkapiKey:"your-quark-api-key"#?需要修改成你的keyserviceName:"quark.dns"servicePort:443-type:googleapiKey:"your-google-api-key"#?需要修改成你的keycx:"your-search-engine-id"#?需要修改成你的engineidserviceName:"google.dns"servicePort:443-type:bingapiKey:"bing-key"#?需要修改成你的keyserviceName:"bing.dns"servicePort:443-type:arxivserviceName:"arxiv.dns"servicePort:443searchRewrite:llmApiKey:"your-deepseek-api-key"#?需要修改成你的keyllmModelName:"deepseek-chat"llmServiceName:"llm-deepseek.internal.dns"llmServicePort:443llmUrl:"https://api.deepseek.com/chat/completions"


    ingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);min-height: 24px;line-height: 2em;visibility: visible;box-sizing: border-box !important;overflow-wrap: break-word !important;">Step.3 直接请求进行测试吧

    下面是使用 lobechat 对接 higress 的效果:


    回复

    使用道具 举报

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

    本版积分规则

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

    • 微信公众号

    • 商务合作

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