Remove Spring Boot dependencies from core modules
- Remove @NestedConfigurationProperty and @ConstructorBinding annotations from model options classes - Remove spring-boot dependency from spring-ai-openai module - Add exclusion for spring-boot-autoconfigure in spring-cloud-function-context dependency - Move configuration metadata to spring-ai-spring-boot-autoconfigure module This change decouples the core AI model implementations from Spring Boot, making the core modules more lightweight and allowing them to be used in non-Spring Boot applications. Configuration properties are now handled by the spring-ai-spring-boot-autoconfigure module instead. Fixes #1540
This commit is contained in:
committed by
Mark Pollack
parent
6d2b22fae3
commit
94ddefc73f
@@ -22,18 +22,17 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.ai.chat.prompt.ChatOptions;
|
||||
import org.springframework.ai.model.function.FunctionCallback;
|
||||
import org.springframework.ai.model.function.FunctionCallingOptions;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.azure.ai.openai.models.AzureChatEnhancementConfiguration;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.springframework.ai.chat.prompt.ChatOptions;
|
||||
import org.springframework.ai.model.function.FunctionCallback;
|
||||
import org.springframework.ai.model.function.FunctionCallingOptions;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* The configuration information for a chat completions request. Completions support a
|
||||
* wide variety of tasks and generate text that continues from or "completes" provided
|
||||
@@ -145,7 +144,6 @@ public class AzureOpenAiChatOptions implements FunctionCallingOptions, ChatOptio
|
||||
* default. Use the enableFunctions to set the functions from the registry to be used
|
||||
* by the ChatModel chat completion requests.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
|
||||
|
||||
@@ -160,7 +158,6 @@ public class AzureOpenAiChatOptions implements FunctionCallingOptions, ChatOptio
|
||||
* functions is set in a prompt options, then the enabled functions are only active
|
||||
* for the duration of this prompt execution.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Set<String> functions = new HashSet<>();
|
||||
|
||||
@@ -194,11 +191,9 @@ public class AzureOpenAiChatOptions implements FunctionCallingOptions, ChatOptio
|
||||
* If provided, the configuration options for available Azure OpenAI chat
|
||||
* enhancements.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private AzureChatEnhancementConfiguration enhancements;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, Object> toolContext;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.ai.chat.prompt.ChatOptions;
|
||||
import org.springframework.ai.minimax.api.MiniMaxApi;
|
||||
import org.springframework.ai.model.function.FunctionCallback;
|
||||
import org.springframework.ai.model.function.FunctionCallingOptions;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -88,7 +87,6 @@ public class MiniMaxChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
/**
|
||||
* Up to 4 sequences where the API will stop generating further tokens.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("stop") List<String> stop;
|
||||
/**
|
||||
* What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output
|
||||
@@ -112,7 +110,6 @@ public class MiniMaxChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* A list of tools the model may call. Currently, only functions are supported as a tool. Use this to
|
||||
* provide a list of functions the model may generate JSON inputs for.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("tools") List<MiniMaxApi.FunctionTool> tools;
|
||||
/**
|
||||
* Controls which (if any) function is called by the model. none means the model will not call a
|
||||
@@ -129,7 +126,6 @@ public class MiniMaxChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* For Default Options the functionCallbacks are registered but disabled by default. Use the enableFunctions to set the functions
|
||||
* from the registry to be used by the ChatModel chat completion requests.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
|
||||
|
||||
@@ -142,14 +138,12 @@ public class MiniMaxChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* Note that function enabled with the default options are enabled for all chat completion requests. This could impact the token count and the billing.
|
||||
* If the functions is set in a prompt options, then the enabled functions are only active for the duration of this prompt execution.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Set<String> functions = new HashSet<>();
|
||||
|
||||
@JsonIgnore
|
||||
private Boolean proxyToolCalls;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, Object> toolContext;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import reactor.core.publisher.Mono;
|
||||
import org.springframework.ai.model.ChatModelDescription;
|
||||
import org.springframework.ai.model.ModelOptionsUtils;
|
||||
import org.springframework.ai.retry.RetryUtils;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -339,7 +338,6 @@ public class MiniMaxApi {
|
||||
* Create a tool of type 'function' and the given function definition.
|
||||
* @param function function definition.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public FunctionTool(Function function) {
|
||||
this(Type.FUNCTION, function);
|
||||
}
|
||||
@@ -381,7 +379,6 @@ public class MiniMaxApi {
|
||||
* @param name tool function name.
|
||||
* @param parameters tool function schema.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public Function(String description, String name, Map<String, Object> parameters) {
|
||||
this(description, name, ModelOptionsUtils.toJsonString(parameters));
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.ai.mistralai.api.MistralAiApi.ChatCompletionRequest.T
|
||||
import org.springframework.ai.mistralai.api.MistralAiApi.FunctionTool;
|
||||
import org.springframework.ai.model.function.FunctionCallback;
|
||||
import org.springframework.ai.model.function.FunctionCallingOptions;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -94,7 +93,6 @@ public class MistralAiChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
* Stop generation if this token is detected. Or if one of these tokens is detected
|
||||
* when providing an array.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("stop") List<String> stop;
|
||||
|
||||
/**
|
||||
@@ -102,7 +100,6 @@ public class MistralAiChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
* tool. Use this to provide a list of functions the model may generate JSON inputs
|
||||
* for.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("tools") List<FunctionTool> tools;
|
||||
|
||||
/**
|
||||
@@ -110,7 +107,6 @@ public class MistralAiChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
* not call a function and instead generates a message. auto means the model can pick
|
||||
* between generating a message or calling a function.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("tool_choice") ToolChoice toolChoice;
|
||||
|
||||
/**
|
||||
@@ -120,7 +116,6 @@ public class MistralAiChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
* disabled by default. Use the enableFunctions to set the functions from the registry
|
||||
* to be used by the ChatModel chat completion requests.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
|
||||
|
||||
@@ -135,14 +130,12 @@ public class MistralAiChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
* functions is set in a prompt options, then the enabled functions are only active
|
||||
* for the duration of this prompt execution.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Set<String> functions = new HashSet<>();
|
||||
|
||||
@JsonIgnore
|
||||
private Boolean proxyToolCalls;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, Object> toolContext;
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.ai.model.ChatModelDescription;
|
||||
import org.springframework.ai.model.ModelOptionsUtils;
|
||||
import org.springframework.ai.observation.conventions.AiProvider;
|
||||
import org.springframework.ai.retry.RetryUtils;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -324,7 +323,6 @@ public class MistralAiApi {
|
||||
* Create a tool of type 'function' and the given function definition.
|
||||
* @param function function definition.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public FunctionTool(Function function) {
|
||||
this(Type.FUNCTION, function);
|
||||
}
|
||||
@@ -362,7 +360,6 @@ public class MistralAiApi {
|
||||
* @param name tool function name.
|
||||
* @param jsonSchema tool function schema as json.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public Function(String description, String name, String jsonSchema) {
|
||||
this(description, name, ModelOptionsUtils.jsonToMap(jsonSchema));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.springframework.ai.chat.prompt.ChatOptions;
|
||||
import org.springframework.ai.model.function.FunctionCallback;
|
||||
import org.springframework.ai.model.function.FunctionCallingOptions;
|
||||
import org.springframework.ai.moonshot.api.MoonshotApi;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -90,10 +89,8 @@ public class MoonshotChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
/**
|
||||
* Up to 5 sequences where the API will stop generating further tokens.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("stop") List<String> stop;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("tools") List<MoonshotApi.FunctionTool> tools;
|
||||
|
||||
/**
|
||||
@@ -115,7 +112,6 @@ public class MoonshotChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
* default. Use the enableFunctions to set the functions from the registry to be used
|
||||
* by the ChatModel chat completion requests.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
|
||||
|
||||
@@ -130,7 +126,6 @@ public class MoonshotChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
* functions is set in a prompt options, then the enabled functions are only active
|
||||
* for the duration of this prompt execution.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Set<String> functions = new HashSet<>();
|
||||
|
||||
@@ -143,7 +138,6 @@ public class MoonshotChatOptions implements FunctionCallingOptions, ChatOptions
|
||||
@JsonIgnore
|
||||
private Boolean proxyToolCalls;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, Object> toolContext;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import reactor.core.publisher.Mono;
|
||||
import org.springframework.ai.model.ChatModelDescription;
|
||||
import org.springframework.ai.model.ModelOptionsUtils;
|
||||
import org.springframework.ai.retry.RetryUtils;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -600,7 +599,6 @@ public class MoonshotApi {
|
||||
* Create a tool of type 'function' and the given function definition.
|
||||
* @param function function definition.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public FunctionTool(Function function) {
|
||||
this(Type.FUNCTION, function);
|
||||
}
|
||||
@@ -638,7 +636,6 @@ public class MoonshotApi {
|
||||
* @param name tool function name.
|
||||
* @param jsonSchema tool function schema as json.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public Function(String description, String name, String jsonSchema) {
|
||||
this(description, name, ModelOptionsUtils.jsonToMap(jsonSchema));
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.ai.model.ModelOptionsUtils;
|
||||
import org.springframework.ai.observation.conventions.AiProvider;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -654,7 +653,6 @@ public class OllamaApi {
|
||||
* Create a tool of type 'function' and the given function definition.
|
||||
* @param function function definition.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public Tool(Function function) {
|
||||
this(Type.FUNCTION, function);
|
||||
}
|
||||
@@ -690,7 +688,6 @@ public class OllamaApi {
|
||||
* @param name tool function name.
|
||||
* @param jsonSchema tool function schema as json.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public Function(String description, String name, String jsonSchema) {
|
||||
this(description, name, ModelOptionsUtils.jsonToMap(jsonSchema));
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.ai.embedding.EmbeddingOptions;
|
||||
import org.springframework.ai.model.ModelOptionsUtils;
|
||||
import org.springframework.ai.model.function.FunctionCallback;
|
||||
import org.springframework.ai.model.function.FunctionCallingOptions;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -280,7 +279,6 @@ public class OllamaOptions implements FunctionCallingOptions, ChatOptions, Embed
|
||||
* For Default Options the functionCallbacks are registered but disabled by default. Use the enableFunctions to set the functions
|
||||
* from the registry to be used by the ChatModel chat completion requests.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
|
||||
|
||||
@@ -292,14 +290,12 @@ public class OllamaOptions implements FunctionCallingOptions, ChatOptions, Embed
|
||||
* Note that function enabled with the default options are enabled for all chat completion requests. This could impact the token count and the billing.
|
||||
* If the functions is set in a prompt options, then the enabled functions are only active for the duration of this prompt execution.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Set<String> functions = new HashSet<>();
|
||||
|
||||
@JsonIgnore
|
||||
private Boolean proxyToolCalls;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, Object> toolContext;
|
||||
|
||||
|
||||
@@ -51,12 +51,6 @@
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- NOTE: Required only by the @ConstructorBinding. -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.rest-assured</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.ai.openai.api.OpenAiApi.ChatCompletionRequest.Respons
|
||||
import org.springframework.ai.openai.api.OpenAiApi.ChatCompletionRequest.StreamOptions;
|
||||
import org.springframework.ai.openai.api.OpenAiApi.ChatCompletionRequest.ToolChoiceBuilder;
|
||||
import org.springframework.ai.openai.api.OpenAiApi.FunctionTool;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -117,7 +116,6 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
/**
|
||||
* Up to 4 sequences where the API will stop generating further tokens.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("stop") List<String> stop;
|
||||
/**
|
||||
* What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output
|
||||
@@ -135,7 +133,6 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* A list of tools the model may call. Currently, only functions are supported as a tool. Use this to
|
||||
* provide a list of functions the model may generate JSON inputs for.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("tools") List<FunctionTool> tools;
|
||||
/**
|
||||
* Controls which (if any) function is called by the model. none means the model will not call a
|
||||
@@ -161,7 +158,6 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* For Default Options the functionCallbacks are registered but disabled by default. Use the enableFunctions to set the functions
|
||||
* from the registry to be used by the ChatModel chat completion requests.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
|
||||
|
||||
@@ -174,7 +170,6 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* Note that function enabled with the default options are enabled for all chat completion requests. This could impact the token count and the billing.
|
||||
* If the functions is set in a prompt options, then the enabled functions are only active for the duration of this prompt execution.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Set<String> functions = new HashSet<>();
|
||||
|
||||
@@ -189,11 +184,9 @@ public class OpenAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
/**
|
||||
* Optional HTTP headers to be added to the chat completion request.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, String> httpHeaders = new HashMap<>();
|
||||
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, Object> toolContext;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.ai.model.ChatModelDescription;
|
||||
import org.springframework.ai.model.ModelOptionsUtils;
|
||||
import org.springframework.ai.openai.api.common.OpenAiApiConstants;
|
||||
import org.springframework.ai.retry.RetryUtils;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -546,7 +545,6 @@ public class OpenAiApi {
|
||||
* Create a tool of type 'function' and the given function definition.
|
||||
* @param function function definition.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public FunctionTool(Function function) {
|
||||
this(Type.FUNCTION, function);
|
||||
}
|
||||
@@ -583,7 +581,6 @@ public class OpenAiApi {
|
||||
* @param name tool function name.
|
||||
* @param jsonSchema tool function schema as json.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public Function(String description, String name, String jsonSchema) {
|
||||
this(description, name, ModelOptionsUtils.jsonToMap(jsonSchema));
|
||||
}
|
||||
@@ -792,7 +789,6 @@ public class OpenAiApi {
|
||||
this(type, "custom_schema", schema, true);
|
||||
}
|
||||
|
||||
@ConstructorBinding
|
||||
public ResponseFormat(Type type, String name, String schema, Boolean strict) {
|
||||
this(type, StringUtils.hasText(schema)? new JsonSchema(name, schema, strict): null);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.springframework.ai.chat.prompt.ChatOptions;
|
||||
import org.springframework.ai.qianfan.api.QianFanApi;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
|
||||
/**
|
||||
* QianFanChatOptions represents the options for performing chat completion using the
|
||||
@@ -67,7 +66,6 @@ public class QianFanChatOptions implements ChatOptions {
|
||||
/**
|
||||
* Up to 4 sequences where the API will stop generating further tokens.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("stop") List<String> stop;
|
||||
/**
|
||||
* What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.ai.chat.prompt.ChatOptions;
|
||||
import org.springframework.ai.model.function.FunctionCallback;
|
||||
import org.springframework.ai.model.function.FunctionCallingOptions;
|
||||
import org.springframework.ai.vertexai.gemini.VertexAiGeminiChatModel.ChatModel;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -96,7 +95,6 @@ public class VertexAiGeminiChatOptions implements FunctionCallingOptions, ChatOp
|
||||
* For Default Options the functionCallbacks are registered but disabled by default. Use the enableFunctions to set the functions
|
||||
* from the registry to be used by the ChatModel chat completion requests.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
|
||||
|
||||
@@ -109,7 +107,6 @@ public class VertexAiGeminiChatOptions implements FunctionCallingOptions, ChatOp
|
||||
* Note that function enabled with the default options are enabled for all chat completion requests. This could impact the token count and the billing.
|
||||
* If the functions is set in a prompt options, then the enabled functions are only active for the duration of this prompt execution.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Set<String> functions = new HashSet<>();
|
||||
|
||||
@@ -122,7 +119,6 @@ public class VertexAiGeminiChatOptions implements FunctionCallingOptions, ChatOp
|
||||
@JsonIgnore
|
||||
private Boolean proxyToolCalls;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, Object> toolContext;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.ai.model.function.FunctionCallback;
|
||||
import org.springframework.ai.model.function.FunctionCallingOptions;
|
||||
import org.springframework.ai.zhipuai.api.ZhiPuAiApi;
|
||||
import org.springframework.ai.zhipuai.api.ZhiPuAiApi.FunctionTool;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -58,7 +57,6 @@ public class ZhiPuAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
/**
|
||||
* The model will stop generating characters specified by stop, and currently only supports a single stop word in the format of ["stop_word1"].
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("stop") List<String> stop;
|
||||
/**
|
||||
* What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output
|
||||
@@ -76,7 +74,6 @@ public class ZhiPuAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* A list of tools the model may call. Currently, only functions are supported as a tool. Use this to
|
||||
* provide a list of functions the model may generate JSON inputs for.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private @JsonProperty("tools") List<FunctionTool> tools;
|
||||
/**
|
||||
* Controls which (if any) function is called by the model. none means the model will not call a
|
||||
@@ -110,7 +107,6 @@ public class ZhiPuAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* For Default Options the functionCallbacks are registered but disabled by default. Use the enableFunctions to set the functions
|
||||
* from the registry to be used by the ChatModel chat completion requests.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
|
||||
|
||||
@@ -123,14 +119,12 @@ public class ZhiPuAiChatOptions implements FunctionCallingOptions, ChatOptions {
|
||||
* Note that function enabled with the default options are enabled for all chat completion requests. This could impact the token count and the billing.
|
||||
* If the functions is set in a prompt options, then the enabled functions are only active for the duration of this prompt execution.
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Set<String> functions = new HashSet<>();
|
||||
|
||||
@JsonIgnore
|
||||
private Boolean proxyToolCalls;
|
||||
|
||||
@NestedConfigurationProperty
|
||||
@JsonIgnore
|
||||
private Map<String, Object> toolContext;
|
||||
// @formatter:on
|
||||
|
||||
@@ -33,7 +33,6 @@ import reactor.core.publisher.Mono;
|
||||
import org.springframework.ai.model.ChatModelDescription;
|
||||
import org.springframework.ai.model.ModelOptionsUtils;
|
||||
import org.springframework.ai.retry.RetryUtils;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -322,7 +321,6 @@ public class ZhiPuAiApi {
|
||||
* Create a tool of type 'function' and the given function definition.
|
||||
* @param function function definition.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public FunctionTool(Function function) {
|
||||
this(Type.FUNCTION, function);
|
||||
}
|
||||
@@ -359,7 +357,6 @@ public class ZhiPuAiApi {
|
||||
* @param name tool function name.
|
||||
* @param jsonSchema tool function schema as json.
|
||||
*/
|
||||
@ConstructorBinding
|
||||
public Function(String description, String name, String jsonSchema) {
|
||||
this(description, name, ModelOptionsUtils.jsonToMap(jsonSchema));
|
||||
}
|
||||
|
||||
@@ -59,6 +59,12 @@
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-context</artifactId>
|
||||
<version>${spring-cloud-function-context.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- production dependencies -->
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"groups": [
|
||||
{
|
||||
"name": "spring.ai.azure.openai.chat.options.enhancements",
|
||||
"type": "com.azure.ai.openai.models.AzureChatEnhancementConfiguration",
|
||||
"sourceType": "org.springframework.ai.azure.openai.AzureOpenAiChatOptions",
|
||||
"sourceMethod": "getEnhancements()"
|
||||
},
|
||||
{
|
||||
"name": "spring.ai.mistralai.chat.options.tool-choice",
|
||||
"type": "org.springframework.ai.mistralai.api.MistralAiApi$ChatCompletionRequest$ToolChoice",
|
||||
"sourceType": "org.springframework.ai.mistralai.MistralAiChatOptions"
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"name": "spring.ai.azure.openai.chat.options.enhancements.grounding",
|
||||
"type": "com.azure.ai.openai.models.AzureChatGroundingEnhancementConfiguration",
|
||||
"sourceType": "com.azure.ai.openai.models.AzureChatEnhancementConfiguration"
|
||||
},
|
||||
{
|
||||
"name": "spring.ai.azure.openai.chat.options.enhancements.ocr",
|
||||
"type": "com.azure.ai.openai.models.AzureChatOCREnhancementConfiguration",
|
||||
"sourceType": "com.azure.ai.openai.models.AzureChatEnhancementConfiguration"
|
||||
}
|
||||
],
|
||||
"hints": []
|
||||
}
|
||||
Reference in New Issue
Block a user