version : 1.0.0-M8 我导入了 spring-ai-starter-model-openaispring-ai-vector-store 但是还是找不到 QuestionAnswerAdvisor,我还需要导入什么依赖呢

Image

Image

Comment From: ai-srcflow

这个 org.springframework.ai spring-ai-advisors-vector-store

Comment From: ai-srcflow

Image 可以的

Comment From: Wyt-blog

Image 可以的

OK呀,我刚刚导入的时候可能idea没刷新,现在好了,谢谢你

Comment From: markpollack

can someone explain what is going on here?

Comment From: Wyt-blog

can someone explain what is going on here?

I imported the wrong Maven dependency,This problem has now been solved

Comment From: jingbio

``` @Autowired public ChatController(ChatClient.Builder builder, VectorStore vectorStore, ChatMemory chatMemory) throws IOException { QuestionAnswerAdvisor questionAnswerAdvisor = QuestionAnswerAdvisor.builder(vectorStore) .searchRequest(SearchRequest.builder().topK(15).build()) .build(); this.chatClient = builder .defaultAdvisors( new MessageChatMemoryAdvisor(chatMemory) ,new PromptChatMemoryAdvisor(chatMemory) ,questionAnswerAdvisor ) .build(); }

@GetMapping(value = "/prompt", produces = "text/html;charset=utf-8")
public String query(String q) {
    return this.chatClient
        .prompt()
        .advisors(am->am.params(Map.of(AbstractChatMemoryAdvisor.CHAT_MEMORY_RETRIEVE_SIZE_KEY,5)))
        .user(q)
        .call().content();
}

```我按照这种写法,模型拿不到我的问题是怎么回事?有遇到过吗?

Comment From: ai-srcflow

``` @Autowired public ChatController(ChatClient.Builder builder, VectorStore vectorStore, ChatMemory chatMemory) throws IOException { QuestionAnswerAdvisor questionAnswerAdvisor = QuestionAnswerAdvisor.builder(vectorStore) .searchRequest(SearchRequest.builder().topK(15).build()) .build(); this.chatClient = builder .defaultAdvisors( new MessageChatMemoryAdvisor(chatMemory) ,new PromptChatMemoryAdvisor(chatMemory) ,questionAnswerAdvisor ) .build(); }

@GetMapping(value = "/prompt", produces = "text/html;charset=utf-8")
public String query(String q) {
    return this.chatClient
        .prompt()
        .advisors(am->am.params(Map.of(AbstractChatMemoryAdvisor.CHAT_MEMORY_RETRIEVE_SIZE_KEY,5)))
        .user(q)
        .call().content();
}

我按照这种写法,模型拿不到我的问题是怎么回事?有遇到过吗?

模型拿不到问题 是什么意思?

Comment From: ai-srcflow

``` @Autowired public ChatController(ChatClient.Builder builder, VectorStore vectorStore, ChatMemory chatMemory) throws IOException { QuestionAnswerAdvisor questionAnswerAdvisor = QuestionAnswerAdvisor.builder(vectorStore) .searchRequest(SearchRequest.builder().topK(15).build()) .build(); this.chatClient = builder .defaultAdvisors( new MessageChatMemoryAdvisor(chatMemory) ,new PromptChatMemoryAdvisor(chatMemory) ,questionAnswerAdvisor ) .build(); }

@GetMapping(value = "/prompt", produces = "text/html;charset=utf-8")
public String query(String q) {
    return this.chatClient
        .prompt()
        .advisors(am->am.params(Map.of(AbstractChatMemoryAdvisor.CHAT_MEMORY_RETRIEVE_SIZE_KEY,5)))
        .user(q)
        .call().content();
}

我按照这种写法,模型拿不到我的问题是怎么回事?有遇到过吗?

你 prompt里面都没传q,你q传到user里干嘛?

return this.chatClient

.prompt(q) .advisors(am->am.params(Map.of(AbstractChatMemoryAdvisor.CHAT_MEMORY_RETRIEVE_SIZE_KEY,5))) .call().content();

写user里边可以的 不同的角色消息 都是可以的
你写user是作为user role 写prompt默认system提示词 都可以的

Comment From: jingbio

``` @Autowired public ChatController(ChatClient.Builder builder, VectorStore vectorStore, ChatMemory chatMemory) throws IOException { QuestionAnswerAdvisor questionAnswerAdvisor = QuestionAnswerAdvisor.builder(vectorStore) .searchRequest(SearchRequest.builder().topK(15).build()) .build(); this.chatClient = builder .defaultAdvisors( new MessageChatMemoryAdvisor(chatMemory) ,new PromptChatMemoryAdvisor(chatMemory) ,questionAnswerAdvisor ) .build(); }

@GetMapping(value = "/prompt", produces = "text/html;charset=utf-8")
public String query(String q) {
    return this.chatClient
        .prompt()
        .advisors(am->am.params(Map.of(AbstractChatMemoryAdvisor.CHAT_MEMORY_RETRIEVE_SIZE_KEY,5)))
        .user(q)
        .call().content();
}

我按照这种写法,模型拿不到我的问题是怎么回事?有遇到过吗?

你 prompt里面都没传q,你q传到user里干嘛?

return this.chatClient

.prompt(q) .advisors(am->am.params(Map.of(AbstractChatMemoryAdvisor.CHAT_MEMORY_RETRIEVE_SIZE_KEY,5))) .call().content();

写user里边可以的 不同的角色消息 都是可以的 你写user是作为user role 写prompt默认system提示词 都可以的

理论来讲模型能够通过我的q参数(问题) 相似性搜索rag知识库,但是返回的结果似乎与q无关,都指向没有拿到q

Comment From: jingbio

更换了qwen2.5的模型后恢复正常使用。应该是不支持qwen3

Comment From: Wyt-blog

更换了qwen2.5的模型后恢复正常使用。应该是不支持qwen3

Image

Image

Image

我用的这个向量模型,但是对话大模型用的qwen3

Comment From: jingbio

更换了qwen2.5的模型后恢复正常使用。应该是不支持qwen3

Image

Image

Image

我用的这个向量模型,但是对话大模型用的qwen3

我的是bge-m3:latest, 1024v

Comment From: hedyvhan

更换了qwen2.5的模型后恢复正常使用。应该是不支持qwen3

Image Image Image 我用的这个向量模型,但是对话大模型用的qwen3

我的是bge-m3:latest, 1024v

Image

Image 我用的这个模型也不行,试了bge-m3:latest和qwen2.5都不行