fix: QueryTransformers must accept input ChatOptions

Fixes gh-3175

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
This commit is contained in:
Thomas Vitale
2025-05-18 14:19:22 +02:00
committed by Mark Pollack
parent d436ee85c4
commit 66d155c153
3 changed files with 3 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2024 the original author or authors. * Copyright 2023-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.ai.chat.client.ChatClient; import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.messages.Message; import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.MessageType; import org.springframework.ai.chat.messages.MessageType;
import org.springframework.ai.chat.prompt.ChatOptions;
import org.springframework.ai.chat.prompt.PromptTemplate; import org.springframework.ai.chat.prompt.PromptTemplate;
import org.springframework.ai.rag.Query; import org.springframework.ai.rag.Query;
import org.springframework.ai.rag.util.PromptAssert; import org.springframework.ai.rag.util.PromptAssert;
@@ -84,7 +83,6 @@ public class CompressionQueryTransformer implements QueryTransformer {
.user(user -> user.text(this.promptTemplate.getTemplate()) .user(user -> user.text(this.promptTemplate.getTemplate())
.param("history", formatConversationHistory(query.history())) .param("history", formatConversationHistory(query.history()))
.param("query", query.text())) .param("query", query.text()))
.options(ChatOptions.builder().build())
.call() .call()
.content(); .content();

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2024 the original author or authors. * Copyright 2023-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.ai.chat.client.ChatClient; import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.prompt.ChatOptions;
import org.springframework.ai.chat.prompt.PromptTemplate; import org.springframework.ai.chat.prompt.PromptTemplate;
import org.springframework.ai.rag.Query; import org.springframework.ai.rag.Query;
import org.springframework.ai.rag.util.PromptAssert; import org.springframework.ai.rag.util.PromptAssert;
@@ -82,7 +81,6 @@ public class RewriteQueryTransformer implements QueryTransformer {
.user(user -> user.text(this.promptTemplate.getTemplate()) .user(user -> user.text(this.promptTemplate.getTemplate())
.param("target", this.targetSearchSystem) .param("target", this.targetSearchSystem)
.param("query", query.text())) .param("query", query.text()))
.options(ChatOptions.builder().build())
.call() .call()
.content(); .content();

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2024 the original author or authors. * Copyright 2023-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -91,7 +91,6 @@ public final class TranslationQueryTransformer implements QueryTransformer {
.user(user -> user.text(this.promptTemplate.getTemplate()) .user(user -> user.text(this.promptTemplate.getTemplate())
.param("targetLanguage", this.targetLanguage) .param("targetLanguage", this.targetLanguage)
.param("query", query.text())) .param("query", query.text()))
.options(ChatOptions.builder().build())
.call() .call()
.content(); .content();