Skip to content

Commit 7651929

Browse files
committed
GH-1540: Remove Spring Boot dependency in core modules
1 parent e970c26 commit 7651929

File tree

12 files changed

+6
-52
lines changed

12 files changed

+6
-52
lines changed

models/spring-ai-azure-openai/src/main/java/org/springframework/ai/azure/openai/AzureOpenAiChatOptions.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.springframework.ai.chat.prompt.ChatOptions;
2626
import org.springframework.ai.model.function.FunctionCallback;
2727
import org.springframework.ai.model.function.FunctionCallingOptions;
28-
import org.springframework.boot.context.properties.NestedConfigurationProperty;
2928
import org.springframework.util.Assert;
3029

3130
import com.azure.ai.openai.models.AzureChatEnhancementConfiguration;
@@ -145,7 +144,6 @@ public class AzureOpenAiChatOptions implements FunctionCallingOptions, ChatOptio
145144
* default. Use the enableFunctions to set the functions from the registry to be used
146145
* by the ChatModel chat completion requests.
147146
*/
148-
@NestedConfigurationProperty
149147
@JsonIgnore
150148
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
151149

@@ -160,7 +158,6 @@ public class AzureOpenAiChatOptions implements FunctionCallingOptions, ChatOptio
160158
* functions is set in a prompt options, then the enabled functions are only active
161159
* for the duration of this prompt execution.
162160
*/
163-
@NestedConfigurationProperty
164161
@JsonIgnore
165162
private Set<String> functions = new HashSet<>();
166163

@@ -194,11 +191,9 @@ public class AzureOpenAiChatOptions implements FunctionCallingOptions, ChatOptio
194191
* If provided, the configuration options for available Azure OpenAI chat
195192
* enhancements.
196193
*/
197-
@NestedConfigurationProperty
198194
@JsonIgnore
199195
private AzureChatEnhancementConfiguration enhancements;
200196

201-
@NestedConfigurationProperty
202197
@JsonIgnore
203198
private Map<String, Object> toolContext;
204199

models/spring-ai-minimax/src/main/java/org/springframework/ai/minimax/MiniMaxChatOptions.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.springframework.ai.minimax.api.MiniMaxApi;
2424
import org.springframework.ai.model.function.FunctionCallback;
2525
import org.springframework.ai.model.function.FunctionCallingOptions;
26-
import org.springframework.boot.context.properties.NestedConfigurationProperty;
2726
import org.springframework.util.Assert;
2827

2928
import java.util.ArrayList;
@@ -86,7 +85,6 @@ public class MiniMaxChatOptions implements FunctionCallingOptions, ChatOptions {
8685
/**
8786
* Up to 4 sequences where the API will stop generating further tokens.
8887
*/
89-
@NestedConfigurationProperty
9088
private @JsonProperty("stop") List<String> stop;
9189
/**
9290
* What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output
@@ -110,7 +108,6 @@ public class MiniMaxChatOptions implements FunctionCallingOptions, ChatOptions {
110108
* A list of tools the model may call. Currently, only functions are supported as a tool. Use this to
111109
* provide a list of functions the model may generate JSON inputs for.
112110
*/
113-
@NestedConfigurationProperty
114111
private @JsonProperty("tools") List<MiniMaxApi.FunctionTool> tools;
115112
/**
116113
* Controls which (if any) function is called by the model. none means the model will not call a
@@ -127,7 +124,6 @@ public class MiniMaxChatOptions implements FunctionCallingOptions, ChatOptions {
127124
* For Default Options the functionCallbacks are registered but disabled by default. Use the enableFunctions to set the functions
128125
* from the registry to be used by the ChatModel chat completion requests.
129126
*/
130-
@NestedConfigurationProperty
131127
@JsonIgnore
132128
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
133129

@@ -140,14 +136,12 @@ public class MiniMaxChatOptions implements FunctionCallingOptions, ChatOptions {
140136
* Note that function enabled with the default options are enabled for all chat completion requests. This could impact the token count and the billing.
141137
* If the functions is set in a prompt options, then the enabled functions are only active for the duration of this prompt execution.
142138
*/
143-
@NestedConfigurationProperty
144139
@JsonIgnore
145140
private Set<String> functions = new HashSet<>();
146141

147142
@JsonIgnore
148143
private Boolean proxyToolCalls;
149144

150-
@NestedConfigurationProperty
151145
@JsonIgnore
152146
private Map<String, Object> toolContext;
153147

models/spring-ai-minimax/src/main/java/org/springframework/ai/minimax/api/MiniMaxApi.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.springframework.ai.model.ChatModelDescription;
2525
import org.springframework.ai.model.ModelOptionsUtils;
2626
import org.springframework.ai.retry.RetryUtils;
27-
import org.springframework.boot.context.properties.bind.ConstructorBinding;
2827
import org.springframework.core.ParameterizedTypeReference;
2928
import org.springframework.http.HttpHeaders;
3029
import org.springframework.http.MediaType;
@@ -165,7 +164,6 @@ public record FunctionTool(
165164
* Create a tool of type 'function' and the given function definition.
166165
* @param function function definition.
167166
*/
168-
@ConstructorBinding
169167
public FunctionTool(Function function) {
170168
this(Type.FUNCTION, function);
171169
}
@@ -207,7 +205,6 @@ public record Function(
207205
* @param name tool function name.
208206
* @param parameters tool function schema.
209207
*/
210-
@ConstructorBinding
211208
public Function(String description, String name, Map<String, Object> parameters) {
212209
this(description, name, ModelOptionsUtils.toJsonString(parameters));
213210
}

models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/MistralAiChatOptions.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.springframework.ai.mistralai.api.MistralAiApi.FunctionTool;
3333
import org.springframework.ai.model.function.FunctionCallback;
3434
import org.springframework.ai.model.function.FunctionCallingOptions;
35-
import org.springframework.boot.context.properties.NestedConfigurationProperty;
3635
import org.springframework.util.Assert;
3736

3837
/**
@@ -92,23 +91,20 @@ public class MistralAiChatOptions implements FunctionCallingOptions, ChatOptions
9291
* Stop generation if this token is detected. Or if one of these tokens is detected
9392
* when providing an array.
9493
*/
95-
@NestedConfigurationProperty
9694
private @JsonProperty("stop") List<String> stop;
9795

9896
/**
9997
* A list of tools the model may call. Currently, only functions are supported as a
10098
* tool. Use this to provide a list of functions the model may generate JSON inputs
10199
* for.
102100
*/
103-
@NestedConfigurationProperty
104101
private @JsonProperty("tools") List<FunctionTool> tools;
105102

106103
/**
107104
* Controls which (if any) function is called by the model. none means the model will
108105
* not call a function and instead generates a message. auto means the model can pick
109106
* between generating a message or calling a function.
110107
*/
111-
@NestedConfigurationProperty
112108
private @JsonProperty("tool_choice") ToolChoice toolChoice;
113109

114110
/**
@@ -118,7 +114,6 @@ public class MistralAiChatOptions implements FunctionCallingOptions, ChatOptions
118114
* disabled by default. Use the enableFunctions to set the functions from the registry
119115
* to be used by the ChatModel chat completion requests.
120116
*/
121-
@NestedConfigurationProperty
122117
@JsonIgnore
123118
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
124119

@@ -133,14 +128,12 @@ public class MistralAiChatOptions implements FunctionCallingOptions, ChatOptions
133128
* functions is set in a prompt options, then the enabled functions are only active
134129
* for the duration of this prompt execution.
135130
*/
136-
@NestedConfigurationProperty
137131
@JsonIgnore
138132
private Set<String> functions = new HashSet<>();
139133

140134
@JsonIgnore
141135
private Boolean proxyToolCalls;
142136

143-
@NestedConfigurationProperty
144137
@JsonIgnore
145138
private Map<String, Object> toolContext;
146139

models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/api/MistralAiApi.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.springframework.ai.model.ChatModelDescription;
3434
import org.springframework.ai.model.ModelOptionsUtils;
3535
import org.springframework.ai.retry.RetryUtils;
36-
import org.springframework.boot.context.properties.bind.ConstructorBinding;
3736
import org.springframework.core.ParameterizedTypeReference;
3837
import org.springframework.http.HttpHeaders;
3938
import org.springframework.http.MediaType;
@@ -126,7 +125,6 @@ public record FunctionTool(@JsonProperty("type") Type type, @JsonProperty("funct
126125
* Create a tool of type 'function' and the given function definition.
127126
* @param function function definition.
128127
*/
129-
@ConstructorBinding
130128
public FunctionTool(Function function) {
131129
this(Type.FUNCTION, function);
132130
}
@@ -164,7 +162,6 @@ public record Function(@JsonProperty("description") String description, @JsonPro
164162
* @param name tool function name.
165163
* @param jsonSchema tool function schema as json.
166164
*/
167-
@ConstructorBinding
168165
public Function(String description, String name, String jsonSchema) {
169166
this(description, name, ModelOptionsUtils.jsonToMap(jsonSchema));
170167
}

models/spring-ai-ollama/src/main/java/org/springframework/ai/ollama/api/OllamaApi.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.apache.commons.logging.LogFactory;
2828
import org.springframework.ai.model.ModelOptionsUtils;
2929
import org.springframework.ai.observation.conventions.AiProvider;
30-
import org.springframework.boot.context.properties.bind.ConstructorBinding;
3130
import org.springframework.http.HttpHeaders;
3231
import org.springframework.http.HttpMethod;
3332
import org.springframework.http.MediaType;
@@ -501,7 +500,6 @@ public record Tool(
501500
* Create a tool of type 'function' and the given function definition.
502501
* @param function function definition.
503502
*/
504-
@ConstructorBinding
505503
public Tool(Function function) {
506504
this(Type.FUNCTION, function);
507505
}
@@ -537,7 +535,6 @@ public record Function(
537535
* @param name tool function name.
538536
* @param jsonSchema tool function schema as json.
539537
*/
540-
@ConstructorBinding
541538
public Function(String description, String name, String jsonSchema) {
542539
this(description, name, ModelOptionsUtils.jsonToMap(jsonSchema));
543540
}

models/spring-ai-ollama/src/main/java/org/springframework/ai/ollama/api/OllamaOptions.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.springframework.ai.model.ModelOptionsUtils;
2929
import org.springframework.ai.model.function.FunctionCallback;
3030
import org.springframework.ai.model.function.FunctionCallingOptions;
31-
import org.springframework.boot.context.properties.NestedConfigurationProperty;
3231
import org.springframework.util.Assert;
3332

3433
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -281,7 +280,6 @@ public class OllamaOptions implements FunctionCallingOptions, ChatOptions, Embed
281280
* For Default Options the functionCallbacks are registered but disabled by default. Use the enableFunctions to set the functions
282281
* from the registry to be used by the ChatModel chat completion requests.
283282
*/
284-
@NestedConfigurationProperty
285283
@JsonIgnore
286284
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
287285

@@ -293,14 +291,12 @@ public class OllamaOptions implements FunctionCallingOptions, ChatOptions, Embed
293291
* Note that function enabled with the default options are enabled for all chat completion requests. This could impact the token count and the billing.
294292
* If the functions is set in a prompt options, then the enabled functions are only active for the duration of this prompt execution.
295293
*/
296-
@NestedConfigurationProperty
297294
@JsonIgnore
298295
private Set<String> functions = new HashSet<>();
299296

300297
@JsonIgnore
301298
private Boolean proxyToolCalls;
302299

303-
@NestedConfigurationProperty
304300
@JsonIgnore
305301
private Map<String, Object> toolContext;
306302

models/spring-ai-openai/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535
<version>${project.parent.version}</version>
3636
</dependency>
3737

38-
<!-- NOTE: Required only by the @ConstructorBinding. -->
39-
<dependency>
40-
<groupId>org.springframework.boot</groupId>
41-
<artifactId>spring-boot</artifactId>
42-
</dependency>
43-
4438
<dependency>
4539
<groupId>io.rest-assured</groupId>
4640
<artifactId>json-path</artifactId>

models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiChatOptions.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.springframework.ai.openai.api.OpenAiApi.ChatCompletionRequest.StreamOptions;
3333
import org.springframework.ai.openai.api.OpenAiApi.ChatCompletionRequest.ToolChoiceBuilder;
3434
import org.springframework.ai.openai.api.OpenAiApi.FunctionTool;
35-
import org.springframework.boot.context.properties.NestedConfigurationProperty;
3635
import org.springframework.util.Assert;
3736

3837
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -116,7 +115,6 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
116115
/**
117116
* Up to 4 sequences where the API will stop generating further tokens.
118117
*/
119-
@NestedConfigurationProperty
120118
private @JsonProperty("stop") List<String> stop;
121119
/**
122120
* What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output
@@ -134,7 +132,6 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
134132
* A list of tools the model may call. Currently, only functions are supported as a tool. Use this to
135133
* provide a list of functions the model may generate JSON inputs for.
136134
*/
137-
@NestedConfigurationProperty
138135
private @JsonProperty("tools") List<FunctionTool> tools;
139136
/**
140137
* Controls which (if any) function is called by the model. none means the model will not call a
@@ -160,7 +157,6 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
160157
* For Default Options the functionCallbacks are registered but disabled by default. Use the enableFunctions to set the functions
161158
* from the registry to be used by the ChatModel chat completion requests.
162159
*/
163-
@NestedConfigurationProperty
164160
@JsonIgnore
165161
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
166162

@@ -173,7 +169,6 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
173169
* Note that function enabled with the default options are enabled for all chat completion requests. This could impact the token count and the billing.
174170
* If the functions is set in a prompt options, then the enabled functions are only active for the duration of this prompt execution.
175171
*/
176-
@NestedConfigurationProperty
177172
@JsonIgnore
178173
private Set<String> functions = new HashSet<>();
179174

@@ -188,11 +183,9 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
188183
/**
189184
* Optional HTTP headers to be added to the chat completion request.
190185
*/
191-
@NestedConfigurationProperty
192186
@JsonIgnore
193187
private Map<String, String> httpHeaders = new HashMap<>();
194188

195-
@NestedConfigurationProperty
196189
@JsonIgnore
197190
private Map<String, Object> toolContext;
198191

models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api/OpenAiApi.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.springframework.ai.model.ModelOptionsUtils;
2626
import org.springframework.ai.openai.api.common.OpenAiApiConstants;
2727
import org.springframework.ai.retry.RetryUtils;
28-
import org.springframework.boot.context.properties.bind.ConstructorBinding;
2928
import org.springframework.core.ParameterizedTypeReference;
3029
import org.springframework.http.HttpHeaders;
3130
import org.springframework.http.MediaType;
@@ -321,7 +320,6 @@ public record FunctionTool(// @formatter:off
321320
* Create a tool of type 'function' and the given function definition.
322321
* @param function function definition.
323322
*/
324-
@ConstructorBinding
325323
public FunctionTool(Function function) {
326324
this(Type.FUNCTION, function);
327325
}
@@ -358,7 +356,6 @@ public record Function(
358356
* @param name tool function name.
359357
* @param jsonSchema tool function schema as json.
360358
*/
361-
@ConstructorBinding
362359
public Function(String description, String name, String jsonSchema) {
363360
this(description, name, ModelOptionsUtils.jsonToMap(jsonSchema));
364361
}
@@ -611,7 +608,6 @@ public ResponseFormat(Type type, String schema) {
611608
this(type, "custom_schema", schema, true);
612609
}
613610

614-
@ConstructorBinding
615611
public ResponseFormat(Type type, String name, String schema, Boolean strict) {
616612
this(type, StringUtils.hasText(schema)? new JsonSchema(name, schema, strict): null);
617613
}

0 commit comments

Comments
 (0)