Skip to content

Remove deprecations post M7 #2873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.springframework.ai.chat.client.advisor.AbstractChatMemoryAdvisor;
import org.springframework.ai.chat.client.advisor.api.AdvisedRequest;
import org.springframework.ai.chat.client.advisor.api.AdvisedResponse;
import org.springframework.ai.chat.client.advisor.api.Advisor;
import org.springframework.ai.chat.client.advisor.api.CallAroundAdvisorChain;
import org.springframework.ai.chat.client.advisor.api.StreamAroundAdvisorChain;
import org.springframework.ai.chat.messages.AssistantMessage;
Expand Down Expand Up @@ -67,51 +66,6 @@ public class VectorStoreChatMemoryAdvisor extends AbstractChatMemoryAdvisor<Vect

private final String systemTextAdvise;

@Deprecated(forRemoval = true, since = "1.0.0-M6")
/**
* @deprecated use {@link Builder} instead.
*/
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore) {
this(vectorStore, DEFAULT_SYSTEM_TEXT_ADVISE);
}

@Deprecated(forRemoval = true, since = "1.0.0-M6")
/**
* @deprecated use {@link Builder} instead.
*/
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore, String systemTextAdvise) {
super(vectorStore);
this.systemTextAdvise = systemTextAdvise;
}

@Deprecated(forRemoval = true, since = "1.0.0-M6")
/**
* @deprecated use {@link Builder} instead.
*/
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore, String defaultConversationId,
int chatHistoryWindowSize) {
this(vectorStore, defaultConversationId, chatHistoryWindowSize, DEFAULT_SYSTEM_TEXT_ADVISE);
}

@Deprecated(forRemoval = true, since = "1.0.0-M6")
/**
* @deprecated use {@link Builder} instead.
*/
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore, String defaultConversationId,
int chatHistoryWindowSize, int order) {
this(vectorStore, defaultConversationId, chatHistoryWindowSize, DEFAULT_SYSTEM_TEXT_ADVISE, order);
}

@Deprecated(forRemoval = true, since = "1.0.0-M6")
/**
* @deprecated use {@link Builder} instead.
*/
public VectorStoreChatMemoryAdvisor(VectorStore vectorStore, String defaultConversationId,
int chatHistoryWindowSize, String systemTextAdvise) {
this(vectorStore, defaultConversationId, chatHistoryWindowSize, systemTextAdvise,
Advisor.DEFAULT_CHAT_MEMORY_PRECEDENCE_ORDER);
}

/**
* Constructor for VectorStoreChatMemoryAdvisor.
* @param vectorStore the vector store instance used for managing and querying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ void functionCallTest() {
""");

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

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

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

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

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,198 +593,71 @@ private ChatCompletionRequestBuilder(ChatCompletionRequest request) {
this.thinking = request.thinking;
}

/**
* @deprecated use {@link #model(ChatModel)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withModel(ChatModel model) {
this.model = model.getValue();
return this;
}

public ChatCompletionRequestBuilder model(ChatModel model) {
this.model = model.getValue();
return this;
}

/**
* @deprecated use {@link #model(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withModel(String model) {
this.model = model;
return this;
}

public ChatCompletionRequestBuilder model(String model) {
this.model = model;
return this;
}

/**
* @deprecated use {@link #messages(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withMessages(List<AnthropicMessage> messages) {
this.messages = messages;
return this;
}

public ChatCompletionRequestBuilder messages(List<AnthropicMessage> messages) {
this.messages = messages;
return this;
}

/**
* @deprecated use {@link #system(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withSystem(String system) {
this.system = system;
return this;
}

public ChatCompletionRequestBuilder system(String system) {
this.system = system;
return this;
}

/**
* @deprecated use {@link #maxTokens(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withMaxTokens(Integer maxTokens) {
this.maxTokens = maxTokens;
return this;
}

public ChatCompletionRequestBuilder maxTokens(Integer maxTokens) {
this.maxTokens = maxTokens;
return this;
}

/**
* @deprecated use {@link #metadata(ChatCompletionRequest.Metadata)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withMetadata(ChatCompletionRequest.Metadata metadata) {
this.metadata = metadata;
return this;
}

public ChatCompletionRequestBuilder metadata(ChatCompletionRequest.Metadata metadata) {
this.metadata = metadata;
return this;
}

/**
* @deprecated use {@link #stopSequences(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withStopSequences(List<String> stopSequences) {
this.stopSequences = stopSequences;
return this;
}

public ChatCompletionRequestBuilder stopSequences(List<String> stopSequences) {
this.stopSequences = stopSequences;
return this;
}

/**
* @deprecated use {@link #stream(Boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withStream(Boolean stream) {
this.stream = stream;
return this;
}

public ChatCompletionRequestBuilder stream(Boolean stream) {
this.stream = stream;
return this;
}

/**
* @deprecated use {@link #temperature(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withTemperature(Double temperature) {
this.temperature = temperature;
return this;
}

public ChatCompletionRequestBuilder temperature(Double temperature) {
this.temperature = temperature;
return this;
}

/**
* @deprecated use {@link #topP(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withTopP(Double topP) {
this.topP = topP;
return this;
}

public ChatCompletionRequestBuilder topP(Double topP) {
this.topP = topP;
return this;
}

/**
* @deprecated use {@link #topK(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withTopK(Integer topK) {
this.topK = topK;
return this;
}

public ChatCompletionRequestBuilder topK(Integer topK) {
this.topK = topK;
return this;
}

/**
* @deprecated use {@link #tools(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withTools(List<Tool> tools) {
this.tools = tools;
return this;
}

public ChatCompletionRequestBuilder tools(List<Tool> tools) {
this.tools = tools;
return this;
}

/**
* @deprecated use {@link #thinking(ChatCompletionRequest.ThinkingConfig)}
* instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withThinking(ChatCompletionRequest.ThinkingConfig thinking) {
this.thinking = thinking;
return this;
}

public ChatCompletionRequestBuilder thinking(ChatCompletionRequest.ThinkingConfig thinking) {
this.thinking = thinking;
return this;
}

/**
* @deprecated use {@link #thinking(ThinkingType, Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M6")
public ChatCompletionRequestBuilder withThinking(ThinkingType type, Integer budgetTokens) {
this.thinking = new ChatCompletionRequest.ThinkingConfig(type, budgetTokens);
return this;
}

public ChatCompletionRequestBuilder thinking(ThinkingType type, Integer budgetTokens) {
this.thinking = new ChatCompletionRequest.ThinkingConfig(type, budgetTokens);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,31 +244,6 @@ void multiModalityTest() throws IOException {
"fruit stand");
}

@Deprecated
@Test
void functionCallTestDeprecated() {

UserMessage userMessage = new UserMessage(
"What's the weather like in San Francisco, Tokyo and Paris? Return the result in Celsius.");

List<Message> messages = new ArrayList<>(List.of(userMessage));

var promptOptions = ToolCallingChatOptions.builder()
.toolCallbacks(List.of(FunctionToolCallback.builder("getCurrentWeather", new MockWeatherService())
.description(
"Get the weather in location. Return temperature in 36°F or 36°C format. Use multi-turn if needed.")
.inputType(MockWeatherService.Request.class)
.build()))
.build();

ChatResponse response = this.chatModel.call(new Prompt(messages, promptOptions));

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

Generation generation = response.getResult();
assertThat(generation.getOutput().getText()).contains("30", "10", "15");
}

@Test
void functionCallTest() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,31 +331,6 @@ void beanStreamOutputConverterRecords() {
assertThat(actorsFilms.movies()).hasSize(5);
}

@Test
@Deprecated
void functionCallTestDeprecated() {

UserMessage userMessage = new UserMessage("What's the weather like in San Francisco, Tokyo, and Paris?");

List<Message> messages = new ArrayList<>(List.of(userMessage));

var promptOptions = OpenAiChatOptions.builder()
.model(OpenAiApi.ChatModel.GPT_4_O.getValue())
.toolCallbacks(List.of(FunctionToolCallback.builder("getCurrentWeather", new MockWeatherService())
.description("Get the weather in location")
.inputType(MockWeatherService.Request.class)
.build()))
.build();

ChatResponse response = this.chatModel.call(new Prompt(messages, promptOptions));

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

assertThat(response.getResult().getOutput().getText()).containsAnyOf("30.0", "30");
assertThat(response.getResult().getOutput().getText()).containsAnyOf("10.0", "10");
assertThat(response.getResult().getOutput().getText()).containsAnyOf("15.0", "15");
}

@Test
void functionCallTest() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,22 +417,12 @@ public Builder toolCallbacks(ToolCallback... toolCallbacks) {
return this;
}

@Deprecated
public Builder functions(Set<String> functionNames) {
return this.toolNames(functionNames);
}

public Builder toolNames(Set<String> toolNames) {
Assert.notNull(toolNames, "Function names must not be null");
this.options.toolNames = toolNames;
return this;
}

@Deprecated
public Builder function(String functionName) {
return this.toolName(functionName);
}

public Builder toolName(String toolName) {
Assert.hasText(toolName, "Function name must not be empty");
this.options.toolNames.add(toolName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,9 @@ public Double getScore() {

/**
* Returns the content formatter associated with this document.
* @deprecated We are considering getting rid of this, please comment on
* https://github.com/spring-projects/spring-ai/issues/1782
* @return the current ContentFormatter instance used for formatting the document
* content.
*/
@Deprecated(since = "1.0.0-M4")
public ContentFormatter getContentFormatter() {
return this.contentFormatter;
}
Expand Down
Loading