
配置redis向量数据库配置依赖dependency groupIdorg.springframework.ai/groupId artifactIdspring-ai-starter-vector-store-redis/artifactId /dependency配置redis数据库属性RAG实践使用spring ai提供的环绕增强advisor功能实现RAG。配置依赖dependency groupIdorg.springframework.ai/groupId artifactIdspring-ai-advisors-vector-store/artifactId /dependency增加QuestionAnswerAdvisor当前1.1.2版本应该是不能直接new了QuestionAnswerAdvisor属于包级私有用builder链式编程可以实现创建只要配置依赖和属性spring ai starter会在程序运行初自动生成VectorStore的Bean直接注入即可使用vectorStore。我在运行时出现报错EmbedingModel不可用于是我手动设置了一个如下图读取文件并写入向量数据库spring ai提供了ETL接口通过对应的Reader就能将文件转换为Document进行一次对话数据文本及结果如下redis中数据