Skip to content

Commit 8deb23a

Browse files
ilayaperumalgmarkpollack
authored andcommitted
Removing deprecated constructors and methods
- VectorStoreChatMemoryAdvisor constructors - "withX" methods in AnthropicApi - Deprecated function methods in VertexAiGeminiChatOptions - Deprecated test methods - Removed deprecation from Document.getContentFormatter - Removed withEmbedding method in SimpleVectorStoreContent") Signed-off-by: Ilayaperumal Gopinathan <[email protected]>
1 parent 35ed49b commit 8deb23a

File tree

8 files changed

+3
-252
lines changed

8 files changed

+3
-252
lines changed

advisors/spring-ai-advisors-vector-store/src/main/java/org/springframework/ai/chat/client/advisor/vectorstore/VectorStoreChatMemoryAdvisor.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.springframework.ai.chat.client.advisor.AbstractChatMemoryAdvisor;
2727
import org.springframework.ai.chat.client.advisor.api.AdvisedRequest;
2828
import org.springframework.ai.chat.client.advisor.api.AdvisedResponse;
29-
import org.springframework.ai.chat.client.advisor.api.Advisor;
3029
import org.springframework.ai.chat.client.advisor.api.CallAroundAdvisorChain;
3130
import org.springframework.ai.chat.client.advisor.api.StreamAroundAdvisorChain;
3231
import org.springframework.ai.chat.messages.AssistantMessage;
@@ -67,51 +66,6 @@ public class VectorStoreChatMemoryAdvisor extends AbstractChatMemoryAdvisor<Vect
6766

6867
private final String systemTextAdvise;
6968

70-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
71-
/**
72-
* @deprecated use {@link Builder} instead.
73-
*/
74-
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore) {
75-
this(vectorStore, DEFAULT_SYSTEM_TEXT_ADVISE);
76-
}
77-
78-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
79-
/**
80-
* @deprecated use {@link Builder} instead.
81-
*/
82-
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore, String systemTextAdvise) {
83-
super(vectorStore);
84-
this.systemTextAdvise = systemTextAdvise;
85-
}
86-
87-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
88-
/**
89-
* @deprecated use {@link Builder} instead.
90-
*/
91-
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore, String defaultConversationId,
92-
int chatHistoryWindowSize) {
93-
this(vectorStore, defaultConversationId, chatHistoryWindowSize, DEFAULT_SYSTEM_TEXT_ADVISE);
94-
}
95-
96-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
97-
/**
98-
* @deprecated use {@link Builder} instead.
99-
*/
100-
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore, String defaultConversationId,
101-
int chatHistoryWindowSize, int order) {
102-
this(vectorStore, defaultConversationId, chatHistoryWindowSize, DEFAULT_SYSTEM_TEXT_ADVISE, order);
103-
}
104-
105-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
106-
/**
107-
* @deprecated use {@link Builder} instead.
108-
*/
109-
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore, String defaultConversationId,
110-
int chatHistoryWindowSize, String systemTextAdvise) {
111-
this(vectorStore, defaultConversationId, chatHistoryWindowSize, systemTextAdvise,
112-
Advisor.DEFAULT_CHAT_MEMORY_PRECEDENCE_ORDER);
113-
}
114-
11569
/**
11670
* Constructor for VectorStoreChatMemoryAdvisor.
11771
* @param vectorStore the vector store instance used for managing and querying

auto-configurations/models/spring-ai-autoconfigure-model-vertex-ai/src/test/java/org/springframework/ai/model/vertexai/autoconfigure/gemini/tool/FunctionCallWithFunctionBeanIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ void functionCallTest() {
6969
""");
7070

7171
ChatResponse response = chatModel.call(new Prompt(List.of(userMessage),
72-
VertexAiGeminiChatOptions.builder().function("weatherFunction").build()));
72+
VertexAiGeminiChatOptions.builder().toolName("weatherFunction").build()));
7373

7474
logger.info("Response: {}", response);
7575

7676
assertThat(response.getResult().getOutput().getText()).contains("30", "10", "15");
7777

7878
response = chatModel.call(new Prompt(List.of(userMessage),
79-
VertexAiGeminiChatOptions.builder().function("weatherFunction3").build()));
79+
VertexAiGeminiChatOptions.builder().toolName("weatherFunction3").build()));
8080

8181
logger.info("Response: {}", response);
8282

@@ -116,7 +116,7 @@ void functionCallWithPortableFunctionCallingOptions() {
116116
assertThat(response.getResult().getOutput().getText()).contains("30", "10", "15");
117117

118118
response = chatModel.call(new Prompt(List.of(userMessage),
119-
VertexAiGeminiChatOptions.builder().function("weatherFunction3").build()));
119+
VertexAiGeminiChatOptions.builder().toolName("weatherFunction3").build()));
120120

121121
logger.info("Response: {}", response);
122122

models/spring-ai-anthropic/src/main/java/org/springframework/ai/anthropic/api/AnthropicApi.java

Lines changed: 0 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -593,198 +593,71 @@ private ChatCompletionRequestBuilder(ChatCompletionRequest request) {
593593
this.thinking = request.thinking;
594594
}
595595

596-
/**
597-
* @deprecated use {@link #model(ChatModel)} instead.
598-
*/
599-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
600-
public ChatCompletionRequestBuilder withModel(ChatModel model) {
601-
this.model = model.getValue();
602-
return this;
603-
}
604-
605596
public ChatCompletionRequestBuilder model(ChatModel model) {
606597
this.model = model.getValue();
607598
return this;
608599
}
609600

610-
/**
611-
* @deprecated use {@link #model(String)} instead.
612-
*/
613-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
614-
public ChatCompletionRequestBuilder withModel(String model) {
615-
this.model = model;
616-
return this;
617-
}
618-
619601
public ChatCompletionRequestBuilder model(String model) {
620602
this.model = model;
621603
return this;
622604
}
623605

624-
/**
625-
* @deprecated use {@link #messages(List)} instead.
626-
*/
627-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
628-
public ChatCompletionRequestBuilder withMessages(List<AnthropicMessage> messages) {
629-
this.messages = messages;
630-
return this;
631-
}
632-
633606
public ChatCompletionRequestBuilder messages(List<AnthropicMessage> messages) {
634607
this.messages = messages;
635608
return this;
636609
}
637610

638-
/**
639-
* @deprecated use {@link #system(String)} instead.
640-
*/
641-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
642-
public ChatCompletionRequestBuilder withSystem(String system) {
643-
this.system = system;
644-
return this;
645-
}
646-
647611
public ChatCompletionRequestBuilder system(String system) {
648612
this.system = system;
649613
return this;
650614
}
651615

652-
/**
653-
* @deprecated use {@link #maxTokens(Integer)} instead.
654-
*/
655-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
656-
public ChatCompletionRequestBuilder withMaxTokens(Integer maxTokens) {
657-
this.maxTokens = maxTokens;
658-
return this;
659-
}
660-
661616
public ChatCompletionRequestBuilder maxTokens(Integer maxTokens) {
662617
this.maxTokens = maxTokens;
663618
return this;
664619
}
665620

666-
/**
667-
* @deprecated use {@link #metadata(ChatCompletionRequest.Metadata)} instead.
668-
*/
669-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
670-
public ChatCompletionRequestBuilder withMetadata(ChatCompletionRequest.Metadata metadata) {
671-
this.metadata = metadata;
672-
return this;
673-
}
674-
675621
public ChatCompletionRequestBuilder metadata(ChatCompletionRequest.Metadata metadata) {
676622
this.metadata = metadata;
677623
return this;
678624
}
679625

680-
/**
681-
* @deprecated use {@link #stopSequences(List)} instead.
682-
*/
683-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
684-
public ChatCompletionRequestBuilder withStopSequences(List<String> stopSequences) {
685-
this.stopSequences = stopSequences;
686-
return this;
687-
}
688-
689626
public ChatCompletionRequestBuilder stopSequences(List<String> stopSequences) {
690627
this.stopSequences = stopSequences;
691628
return this;
692629
}
693630

694-
/**
695-
* @deprecated use {@link #stream(Boolean)} instead.
696-
*/
697-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
698-
public ChatCompletionRequestBuilder withStream(Boolean stream) {
699-
this.stream = stream;
700-
return this;
701-
}
702-
703631
public ChatCompletionRequestBuilder stream(Boolean stream) {
704632
this.stream = stream;
705633
return this;
706634
}
707635

708-
/**
709-
* @deprecated use {@link #temperature(Double)} instead.
710-
*/
711-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
712-
public ChatCompletionRequestBuilder withTemperature(Double temperature) {
713-
this.temperature = temperature;
714-
return this;
715-
}
716-
717636
public ChatCompletionRequestBuilder temperature(Double temperature) {
718637
this.temperature = temperature;
719638
return this;
720639
}
721640

722-
/**
723-
* @deprecated use {@link #topP(Double)} instead.
724-
*/
725-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
726-
public ChatCompletionRequestBuilder withTopP(Double topP) {
727-
this.topP = topP;
728-
return this;
729-
}
730-
731641
public ChatCompletionRequestBuilder topP(Double topP) {
732642
this.topP = topP;
733643
return this;
734644
}
735645

736-
/**
737-
* @deprecated use {@link #topK(Integer)} instead.
738-
*/
739-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
740-
public ChatCompletionRequestBuilder withTopK(Integer topK) {
741-
this.topK = topK;
742-
return this;
743-
}
744-
745646
public ChatCompletionRequestBuilder topK(Integer topK) {
746647
this.topK = topK;
747648
return this;
748649
}
749650

750-
/**
751-
* @deprecated use {@link #tools(List)} instead.
752-
*/
753-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
754-
public ChatCompletionRequestBuilder withTools(List<Tool> tools) {
755-
this.tools = tools;
756-
return this;
757-
}
758-
759651
public ChatCompletionRequestBuilder tools(List<Tool> tools) {
760652
this.tools = tools;
761653
return this;
762654
}
763655

764-
/**
765-
* @deprecated use {@link #thinking(ChatCompletionRequest.ThinkingConfig)}
766-
* instead.
767-
*/
768-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
769-
public ChatCompletionRequestBuilder withThinking(ChatCompletionRequest.ThinkingConfig thinking) {
770-
this.thinking = thinking;
771-
return this;
772-
}
773-
774656
public ChatCompletionRequestBuilder thinking(ChatCompletionRequest.ThinkingConfig thinking) {
775657
this.thinking = thinking;
776658
return this;
777659
}
778660

779-
/**
780-
* @deprecated use {@link #thinking(ThinkingType, Integer)} instead.
781-
*/
782-
@Deprecated(forRemoval = true, since = "1.0.0-M6")
783-
public ChatCompletionRequestBuilder withThinking(ThinkingType type, Integer budgetTokens) {
784-
this.thinking = new ChatCompletionRequest.ThinkingConfig(type, budgetTokens);
785-
return this;
786-
}
787-
788661
public ChatCompletionRequestBuilder thinking(ThinkingType type, Integer budgetTokens) {
789662
this.thinking = new ChatCompletionRequest.ThinkingConfig(type, budgetTokens);
790663
return this;

models/spring-ai-bedrock-converse/src/test/java/org/springframework/ai/bedrock/converse/BedrockProxyChatModelIT.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -244,31 +244,6 @@ void multiModalityTest() throws IOException {
244244
"fruit stand");
245245
}
246246

247-
@Deprecated
248-
@Test
249-
void functionCallTestDeprecated() {
250-
251-
UserMessage userMessage = new UserMessage(
252-
"What's the weather like in San Francisco, Tokyo and Paris? Return the result in Celsius.");
253-
254-
List<Message> messages = new ArrayList<>(List.of(userMessage));
255-
256-
var promptOptions = ToolCallingChatOptions.builder()
257-
.toolCallbacks(List.of(FunctionToolCallback.builder("getCurrentWeather", new MockWeatherService())
258-
.description(
259-
"Get the weather in location. Return temperature in 36°F or 36°C format. Use multi-turn if needed.")
260-
.inputType(MockWeatherService.Request.class)
261-
.build()))
262-
.build();
263-
264-
ChatResponse response = this.chatModel.call(new Prompt(messages, promptOptions));
265-
266-
logger.info("Response: {}", response);
267-
268-
Generation generation = response.getResult();
269-
assertThat(generation.getOutput().getText()).contains("30", "10", "15");
270-
}
271-
272247
@Test
273248
void functionCallTest() {
274249

models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/OpenAiChatModelIT.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -341,31 +341,6 @@ void beanStreamOutputConverterRecords() {
341341
assertThat(actorsFilms.movies()).hasSize(5);
342342
}
343343

344-
@Test
345-
@Deprecated
346-
void functionCallTestDeprecated() {
347-
348-
UserMessage userMessage = new UserMessage("What's the weather like in San Francisco, Tokyo, and Paris?");
349-
350-
List<Message> messages = new ArrayList<>(List.of(userMessage));
351-
352-
var promptOptions = OpenAiChatOptions.builder()
353-
.model(OpenAiApi.ChatModel.GPT_4_O.getValue())
354-
.toolCallbacks(List.of(FunctionToolCallback.builder("getCurrentWeather", new MockWeatherService())
355-
.description("Get the weather in location")
356-
.inputType(MockWeatherService.Request.class)
357-
.build()))
358-
.build();
359-
360-
ChatResponse response = this.chatModel.call(new Prompt(messages, promptOptions));
361-
362-
logger.info("Response: {}", response);
363-
364-
assertThat(response.getResult().getOutput().getText()).containsAnyOf("30.0", "30");
365-
assertThat(response.getResult().getOutput().getText()).containsAnyOf("10.0", "10");
366-
assertThat(response.getResult().getOutput().getText()).containsAnyOf("15.0", "15");
367-
}
368-
369344
@Test
370345
void functionCallTest() {
371346

models/spring-ai-vertex-ai-gemini/src/main/java/org/springframework/ai/vertexai/gemini/VertexAiGeminiChatOptions.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -417,22 +417,12 @@ public Builder toolCallbacks(ToolCallback... toolCallbacks) {
417417
return this;
418418
}
419419

420-
@Deprecated
421-
public Builder functions(Set<String> functionNames) {
422-
return this.toolNames(functionNames);
423-
}
424-
425420
public Builder toolNames(Set<String> toolNames) {
426421
Assert.notNull(toolNames, "Function names must not be null");
427422
this.options.toolNames = toolNames;
428423
return this;
429424
}
430425

431-
@Deprecated
432-
public Builder function(String functionName) {
433-
return this.toolName(functionName);
434-
}
435-
436426
public Builder toolName(String toolName) {
437427
Assert.hasText(toolName, "Function name must not be empty");
438428
this.options.toolNames.add(toolName);

spring-ai-commons/src/main/java/org/springframework/ai/document/Document.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,9 @@ public Double getScore() {
247247

248248
/**
249249
* Returns the content formatter associated with this document.
250-
* @deprecated We are considering getting rid of this, please comment on
251-
* https://github.com/spring-projects/spring-ai/issues/1782
252250
* @return the current ContentFormatter instance used for formatting the document
253251
* content.
254252
*/
255-
@Deprecated(since = "1.0.0-M4")
256253
public ContentFormatter getContentFormatter() {
257254
return this.contentFormatter;
258255
}

0 commit comments

Comments
 (0)