-
Notifications
You must be signed in to change notification settings - Fork 1.8k
GH-1540: Remove Spring Boot dependency in core modules #1553
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ | |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar comment to above with FunctionCallback in Azure options. |
||
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; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,6 @@ | |
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,23 +93,20 @@ 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; | ||
|
||
/** | ||
* 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see an entry for this in the metadata.json file. |
||
private @JsonProperty("tools") List<FunctionTool> tools; | ||
|
||
/** | ||
* Controls which (if any) function is called by the model. none means the model will | ||
* 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; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ | |
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<>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar situation to other |
||
|
||
|
@@ -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; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,6 @@ | |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as before |
||
@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; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,6 @@ | |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as before |
||
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; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not even sure if this should work even if we kept the annotation as how does boot know what class that implements
FunctionCallback
to create?I tried the following in
application.yaml
and got the following error
This can be researched in a separate issue as it is more important to remove the boot dependency in core than wait for solution to these sort of infrequently used options.