Closed jottinger closed 1 month ago
i had same issues,and if i remove 'spring-ai-openai-spring-boot-starter',the program was able to start
i had same issues,and if i remove 'spring-ai-openai-spring-boot-starter',the program was able to start
i found the problem,need add 'spring-boot-starter-web' in you maven
i have the same issue when i import spring reactive web instead of spring boot starter web
Me too
If you have configured "web-application-type", you can try to remove it and restart from
server:
port: 8091
spring:
application:
name: Spring-ai-demo
main:
web-application-type: reactive
to
server:
port: 8091
spring:
application:
name: Spring-ai-demo
Thanks for reporting, we will aim to fix this for M2
I was wondering why I need spring-boot-starter-web if I am not building a web applicaiton but only building a commandline application? I don't believe OpenAI (or the other frameworks) need anything other than a REST API client? At least I did not need one when building openai apps using Python.
Thanks for the patience. There is related discussion here #1066
If we add the starter-web dependency to spring-ai-openai
and other modules that use RestClient
, then everything built with a spring-ai-openai
dependency will be a web app and will bring in embedded tomcat. Also a command line app will then need to set the application property spring.main.web-application-type=none
I think adding the starter-web dependency to spring-ai-openai
is the best compromise and document how to better handle building command line AI apps.
Any other suggestions?
I had wanted to get this done for a while, but i'm afraid I need to kick the can on it to M4 as I don't want to make such a change right before we release M3 today.
I think this is a workable solution, but I'd call it out early and explicitly in the docs.
On Mon, Oct 7, 2024 at 12:37 PM Mark Pollack @.***> wrote:
Thanks for the patience. There is related discussion here #1066 https://github.com/spring-projects/spring-ai/issues/1066
If we add the starter-web dependency to spring-ai-openai and other modules that use RestClient, then everything built with a spring-ai-openai dependency will be a web app and will bring in embedded tomcat. Also a command line app will then need to set the application property spring.main.web-application-type=none
I think adding the starter-web dependency to spring-ai-openai is the best compromise and document how to better handle building command line AI apps.
Any other suggestions?
I had wanted to get this done for a while, but i'm afraid I need to kick the can on it to M4 as I don't want to make such a change right before we release M3 today.
— Reply to this email directly, view it on GitHub https://github.com/spring-projects/spring-ai/issues/524#issuecomment-2397403937, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSNGTHIVXS2RZYDEXVRZLZ2K2FRAVCNFSM6AAAAABFPPXQBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJXGQYDGOJTG4 . You are receiving this because you authored the thread.Message ID: @.***>
-- Joseph B. Ottinger http://www.enigmastation.com http://enigmastation.com To the beautiful and the wise,
@markpollack it might take a bit more time, but could it be an idea to pitch the introduction of a new Starter in the Spring Boot project for client applications? Something like a "spring-boot-starter-http-client" which includes the RestClientAutoconfiguration and WebClientAutoconfiguration? In the past few years, building CLI applications with Java has become more common (also thanks to projects like GraalVM and Spring Shell). And now with Spring AI there are many more use cases for CLI/Client applications.
Another pain point is for people building reactive applications, that currently have to bring the entire imperative Spring stack just to get the RestClient auto configuration needed by Spring AI. Having a dedicated HTTP Client starter in Spring Boot would improve things for reactive apps as well, without forcing to include Tomcat even if Reactor Netty is used. And vice-versa, it would make it possible for imperative apps to use streaming in Spring AI without having to include the full reactive server stack.
Hopefully #1550 would provide a relief.
You can create a non-web boot application (e.g. spring-boot-starter
) and use both call() and stream() without additional spring web/flux depdenceies.
YOU MUST though set the spring.main.web-application-type=none
because of https://github.com/spring-projects/spring-boot/issues/12973 We do not want to pre-set this property in the spring-ai because than the you have to explicitly change it for we applications.
The PR would also resolves: #1066
I created a new Spring AI project using the Spring Initializr, including
spring-shell-starter
andspring-ai-openai-spring-boot-starter
. After adding an OpenAI key, I get a failure on running a simple test that injects a ChatClient:And if I run the application (ignoring the tests):
This is trivially repaired by adding a dependency on spring-boot-starter-web (and certainly has other solutions, too, because you don't HAVE to use the starter to get these classes) but it's not clearly indicated in the Spring AI documentation, and I'd expect the Initializr project to include those dependencies itself as well.