-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
…ules Resolves spring-projects#1540 - 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.
@@ -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 |
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
spring:
ai:
azure:
openai:
chat:
options:
function-callbacks:
- name: "functionName1"
description: "Description of what function1 does"
input-type-schema: |
{
"type": "object",
"properties": {
"param1": {
"type": "string"
}
}
}
- name: "functionName2"
description: "Description of what function2 does"
input-type-schema: |
{
"type": "object",
"properties": {
"param2": {
"type": "integer"
}
}
}
and got the following error
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-10-30T11:41:55.878-04:00 ERROR 11409 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Binding to target [Bindable@7b6141f0 type = java.util.List<org.springframework.ai.model.function.FunctionCallback>, value = 'provided', annotations = array<Annotation>[@com.fasterxml.jackson.annotation.JsonIgnore(true)], bindMethod = [null]] failed:
Property: spring.ai.azure.openai.chat.options.function-callbacks[0].description
Value: "Description of what function1 does"
Origin: class path resource [application.yaml] - 9:30
Reason: The elements [spring.ai.azure.openai.chat.options.function-callbacks[0].description,spring.ai.azure.openai.chat.options.function-callbacks[0].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[0].name,spring.ai.azure.openai.chat.options.function-callbacks[1].description,spring.ai.azure.openai.chat.options.function-callbacks[1].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[1].name] were left unbound.
Property: spring.ai.azure.openai.chat.options.function-callbacks[0].input-type-schema
Value: "{
"type": "object",
"properties": {
"param1": {
"type": "string"
}
}
}
"
Origin: class path resource [application.yaml] - 10:36
Reason: The elements [spring.ai.azure.openai.chat.options.function-callbacks[0].description,spring.ai.azure.openai.chat.options.function-callbacks[0].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[0].name,spring.ai.azure.openai.chat.options.function-callbacks[1].description,spring.ai.azure.openai.chat.options.function-callbacks[1].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[1].name] were left unbound.
Property: spring.ai.azure.openai.chat.options.function-callbacks[0].name
Value: "functionName1"
Origin: class path resource [application.yaml] - 8:23
Reason: The elements [spring.ai.azure.openai.chat.options.function-callbacks[0].description,spring.ai.azure.openai.chat.options.function-callbacks[0].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[0].name,spring.ai.azure.openai.chat.options.function-callbacks[1].description,spring.ai.azure.openai.chat.options.function-callbacks[1].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[1].name] were left unbound.
Property: spring.ai.azure.openai.chat.options.function-callbacks[1].description
Value: "Description of what function2 does"
Origin: class path resource [application.yaml] - 20:30
Reason: The elements [spring.ai.azure.openai.chat.options.function-callbacks[0].description,spring.ai.azure.openai.chat.options.function-callbacks[0].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[0].name,spring.ai.azure.openai.chat.options.function-callbacks[1].description,spring.ai.azure.openai.chat.options.function-callbacks[1].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[1].name] were left unbound.
Property: spring.ai.azure.openai.chat.options.function-callbacks[1].input-type-schema
Value: "{
"type": "object",
"properties": {
"param2": {
"type": "integer"
}
}
}"
Origin: class path resource [application.yaml] - 21:36
Reason: The elements [spring.ai.azure.openai.chat.options.function-callbacks[0].description,spring.ai.azure.openai.chat.options.function-callbacks[0].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[0].name,spring.ai.azure.openai.chat.options.function-callbacks[1].description,spring.ai.azure.openai.chat.options.function-callbacks[1].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[1].name] were left unbound.
Property: spring.ai.azure.openai.chat.options.function-callbacks[1].name
Value: "functionName2"
Origin: class path resource [application.yaml] - 19:23
Reason: The elements [spring.ai.azure.openai.chat.options.function-callbacks[0].description,spring.ai.azure.openai.chat.options.function-callbacks[0].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[0].name,spring.ai.azure.openai.chat.options.function-callbacks[1].description,spring.ai.azure.openai.chat.options.function-callbacks[1].input-type-schema,spring.ai.azure.openai.chat.options.function-callbacks[1].name] were left unbound.
Action:
Update your application's configuration
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.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment to above with FunctionCallback in Azure options.
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 comment
The 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.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
similar situation to other List< Rich Data Type>
comments.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as before
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as before
@@ -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 |
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.
same comment as before
We should create an issue to investigate the impact of the following usages of tools
as well as the following
Probably need to create some sample projects that use this declarative functionality. A bit of detective work on the commit history for |
merged in 94ddefc |
No description provided.