Skip to content

Commit 76bee8c

Browse files
committed
Remove deprecations from 1.0.0-M8
Remove deprecated DocumentCompressor/Ranker/Selector - These are replaced by the org.springframework.ai.rag.postretrieval.document.DocumentPostProcessor Remove deprecated Chatclient/DefaultChatClient methods In ChatClient: - Remove defaultTools and tools as these are replaced by defaultToolCallbacks and defaultToolNames respectively. In DefaultChatClient: - Remove tools method implementation - Remove unused DefaultCallPromptResponseSpec and DefaultStreamPromptResponseSpec Remove deprecated addMessage from Prompt Remove deprecated isInternalToolExecutionEnabled() from ToolCallingChatOptions - This is replaced by getInternalToolExecutionEnabled() Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
1 parent 9e71b16 commit 76bee8c

File tree

11 files changed

+0
-346
lines changed

11 files changed

+0
-346
lines changed

spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/ChatClient.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,6 @@ interface ChatClientRequestSpec {
222222

223223
ChatClientRequestSpec toolNames(String... toolNames);
224224

225-
/**
226-
* Use toolNames instead
227-
*/
228-
@Deprecated(forRemoval = true, since = "1.0.0-m8")
229-
ChatClientRequestSpec tools(String... toolNames);
230-
231225
ChatClientRequestSpec tools(Object... toolObjects);
232226

233227
ChatClientRequestSpec toolCallbacks(ToolCallback... toolCallbacks);
@@ -295,9 +289,6 @@ interface Builder {
295289

296290
Builder defaultToolNames(String... toolNames);
297291

298-
@Deprecated
299-
Builder defaultTools(String... tools);
300-
301292
Builder defaultTools(Object... toolObjects);
302293

303294
Builder defaultToolCallbacks(ToolCallback... toolCallbacks);

spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/DefaultChatClient.java

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import org.springframework.ai.chat.model.ChatModel;
5252
import org.springframework.ai.chat.model.ChatResponse;
5353
import org.springframework.ai.chat.model.Generation;
54-
import org.springframework.ai.chat.model.StreamingChatModel;
5554
import org.springframework.ai.chat.prompt.ChatOptions;
5655
import org.springframework.ai.chat.prompt.Prompt;
5756
import org.springframework.ai.content.Media;
@@ -835,11 +834,6 @@ public <T extends ChatOptions> ChatClientRequestSpec options(T options) {
835834
return this;
836835
}
837836

838-
@Override
839-
public ChatClientRequestSpec tools(String... toolNames) {
840-
return this.toolNames(toolNames);
841-
}
842-
843837
@Override
844838
public ChatClientRequestSpec toolNames(String... toolNames) {
845839
Assert.notNull(toolNames, "toolNames cannot be null");
@@ -992,72 +986,4 @@ private BaseAdvisorChain buildAdvisorChain() {
992986

993987
}
994988

995-
// Prompt
996-
997-
@Deprecated // never used, to be removed
998-
public static class DefaultCallPromptResponseSpec implements CallPromptResponseSpec {
999-
1000-
private final ChatModel chatModel;
1001-
1002-
private final Prompt prompt;
1003-
1004-
public DefaultCallPromptResponseSpec(ChatModel chatModel, Prompt prompt) {
1005-
Assert.notNull(chatModel, "chatModel cannot be null");
1006-
Assert.notNull(prompt, "prompt cannot be null");
1007-
this.chatModel = chatModel;
1008-
this.prompt = prompt;
1009-
}
1010-
1011-
public String content() {
1012-
return doGetChatResponse(this.prompt).getResult().getOutput().getText();
1013-
}
1014-
1015-
public List<String> contents() {
1016-
return doGetChatResponse(this.prompt).getResults().stream().map(r -> r.getOutput().getText()).toList();
1017-
}
1018-
1019-
public ChatResponse chatResponse() {
1020-
return doGetChatResponse(this.prompt);
1021-
}
1022-
1023-
private ChatResponse doGetChatResponse(Prompt prompt) {
1024-
return this.chatModel.call(prompt);
1025-
}
1026-
1027-
}
1028-
1029-
@Deprecated // never used, to be removed
1030-
public static class DefaultStreamPromptResponseSpec implements StreamPromptResponseSpec {
1031-
1032-
private final Prompt prompt;
1033-
1034-
private final StreamingChatModel chatModel;
1035-
1036-
public DefaultStreamPromptResponseSpec(StreamingChatModel streamingChatModel, Prompt prompt) {
1037-
Assert.notNull(streamingChatModel, "streamingChatModel cannot be null");
1038-
Assert.notNull(prompt, "prompt cannot be null");
1039-
this.chatModel = streamingChatModel;
1040-
this.prompt = prompt;
1041-
}
1042-
1043-
public Flux<ChatResponse> chatResponse() {
1044-
return doGetFluxChatResponse(this.prompt);
1045-
}
1046-
1047-
private Flux<ChatResponse> doGetFluxChatResponse(Prompt prompt) {
1048-
return this.chatModel.stream(prompt);
1049-
}
1050-
1051-
public Flux<String> content() {
1052-
return doGetFluxChatResponse(this.prompt).map(r -> {
1053-
if (r.getResult() == null || r.getResult().getOutput() == null
1054-
|| r.getResult().getOutput().getText() == null) {
1055-
return "";
1056-
}
1057-
return r.getResult().getOutput().getText();
1058-
}).filter(StringUtils::hasLength);
1059-
}
1060-
1061-
}
1062-
1063989
}

spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/DefaultChatClientBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,6 @@ public Builder defaultSystem(Consumer<PromptSystemSpec> systemSpecConsumer) {
150150
return this;
151151
}
152152

153-
@Override
154-
public Builder defaultTools(String... toolNames) {
155-
return defaultToolNames(toolNames);
156-
}
157-
158153
@Override
159154
public Builder defaultToolNames(String... toolNames) {
160155
this.defaultRequest.toolNames(toolNames);

spring-ai-model/src/main/java/org/springframework/ai/chat/prompt/Prompt.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,6 @@ public Builder messages(List<Message> messages) {
236236
return this;
237237
}
238238

239-
@Deprecated
240-
public Builder addMessage(Message message) {
241-
if (this.messages == null) {
242-
this.messages = new ArrayList<>();
243-
}
244-
this.messages.add(message);
245-
return this;
246-
}
247-
248239
public Builder chatOptions(ChatOptions chatOptions) {
249240
this.chatOptions = chatOptions;
250241
return this;

spring-ai-model/src/main/java/org/springframework/ai/model/tool/ToolCallingChatOptions.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,6 @@ public interface ToolCallingChatOptions extends ChatOptions {
7070
@Nullable
7171
Boolean getInternalToolExecutionEnabled();
7272

73-
/**
74-
* Whether the {@link ChatModel} is responsible for executing the tools requested by
75-
* the model or if the tools should be executed directly by the caller.
76-
*/
77-
@Nullable
78-
@Deprecated
79-
default Boolean isInternalToolExecutionEnabled() {
80-
return getInternalToolExecutionEnabled();
81-
}
82-
8373
/**
8474
* Set whether the {@link ChatModel} is responsible for executing the tools requested
8575
* by the model or if the tools should be executed directly by the caller.

spring-ai-rag/src/main/java/org/springframework/ai/rag/postretrieval/compression/DocumentCompressor.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

spring-ai-rag/src/main/java/org/springframework/ai/rag/postretrieval/compression/package-info.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

spring-ai-rag/src/main/java/org/springframework/ai/rag/postretrieval/ranking/DocumentRanker.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

spring-ai-rag/src/main/java/org/springframework/ai/rag/postretrieval/ranking/package-info.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

spring-ai-rag/src/main/java/org/springframework/ai/rag/postretrieval/selection/DocumentSelector.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)