当前位置: 首页 > news >正文

spring-ai-alibaba DashScopeCloudStore自动装配问题

问题

在学习spring-ai-alibaba时,发现1.0.0.2版本在自动装配DashScopeCloudStore时,会报如下错误:

Field dashScopeCloudStore in com.example.spring_ai_alibaba_examples.examples.SpringAiAlibabaExample01 required a bean of type 'com.alibaba.cloud.ai.dashscope.rag.DashScopeCloudStore' that could not be found.

意思是没有找到DashScopeCloudStore

原因分析

查看了一下spring-ai-alibaba-autoconfigure-dashscope包里确实没有提供对应的Bean,也就是说该类没有自动装配

上网搜了一下,发现1.0.0-M6.1版本已经有人提出过这个问题了(DashScopeCloudStore Auto-configuration 注入问题 · Issue #84 · springaialibaba/spring-ai-alibaba-website),仍然是open状态,尚未解决

问题解决

那就只能自己创建一个了

        this.dashScopeCloudStore = new DashScopeCloudStore(DashScopeApi.builder().apiKey("your api key").build(), new DashScopeStoreOptions("知识库名称"));

这只是一个最简化样例,在创建DashScopeApi和DashScopeStoreOptions的时候可以添加许多其他参数

优化建议

建议官方提供一个自动装配的DashScopeApi
然后就可以通过以下方式使用DashScopeCloudStore
 

    @Beanpublic DashScopeCloudStore dashScopeCloudStore(DashScopeApi dashScopeApi) {return new DashScopeCloudStore(dashScopeApi, new DashScopeStoreOptions("测试库"));}


文章转载自:
http://ambit.bdypl.cn
http://beebread.bdypl.cn
http://archaeologize.bdypl.cn
http://behaviourist.bdypl.cn
http://areopagitic.bdypl.cn
http://cambo.bdypl.cn
http://broma.bdypl.cn
http://aerocurve.bdypl.cn
http://capsheaf.bdypl.cn
http://biophilosophy.bdypl.cn
http://bant.bdypl.cn
http://behaviour.bdypl.cn
http://algerian.bdypl.cn
http://bating.bdypl.cn
http://babirussa.bdypl.cn
http://bride.bdypl.cn
http://bice.bdypl.cn
http://asynchronous.bdypl.cn
http://caddice.bdypl.cn
http://backside.bdypl.cn
http://bearskin.bdypl.cn
http://aircrew.bdypl.cn
http://carded.bdypl.cn
http://barn.bdypl.cn
http://amaze.bdypl.cn
http://brew.bdypl.cn
http://axiomatic.bdypl.cn
http://astutely.bdypl.cn
http://antiauthoritarian.bdypl.cn
http://arboretum.bdypl.cn
http://www.dtcms.com/a/261984.html

相关文章:

  • Pytest自动化测试执行环境切换的2种解决方案
  • Word之空白页删除2
  • 访问不了/druid/index.html (sql.html 或 login.html)
  • 自学嵌入式 day26 - 系统编程 文件io 目录操作
  • Insar 相位展开真实的数据集的生成与下载(随机矩阵放大,zernike 仿真包裹相位)
  • 【编译原理】期末
  • 多表连接查询:语法、注意事项与最佳实践
  • Java+Python智能化网盘【Day9-1】
  • 趣味数据结构之——栈
  • 1 Studying《Computer Vision: Algorithms and Applications 2nd Edition》1-5
  • 基于springboot的海产品交易系统
  • AI代码助手实践指南
  • 03.BUG
  • (线性代数)矩阵的奇异值Singular Value
  • 测量 Linux 中进程上下文切换需要的时间
  • python 项目利用uv管理python包依赖
  • 如何在 Ubuntu 上通过终端或在 VirtualBox 中安装 GCC
  • 大事件项目记录11-文章分类接口开发-删除文章分类
  • zookeeper Curator(3):Watch事件监听
  • c++学习(一、指针)
  • 14、ElasticSearch
  • Kioptrix Level1
  • Word之电子章制作——1
  • 计算机网络——概述
  • [特殊字符] Kolors AI中文绘画:让AI轻松“读懂”中文,创作国风新艺术
  • 【纯干货】调整word目录中的行距以及右对齐页码
  • 马斯克的 Neuralink:当意念突破肉体的边界,未来已来
  • SLAM中的非线性优化-2D图优化之零空间(十五)
  • LINUX628 NFS 多web;主从dns;ntp;samba
  • 在C++中#pragma“可选预处理指令的作用“。