1、Loiane GronerOrchestrating AI Services with Spring AIAI is all about Python,right?How does anyone get started?Oops,need to change the modelJava dev,got Spring?Abstractions and implementations Clean architecture change AI model with one line of configuration!Building blocks Observability already incl
2、udedDirector of Engineering BNYHi,Im Loiane! is Spring AI?Declarative API for:Chat+Embeddings Prompt templates Vector search Function calling(Tools)Built for Spring BootChatSimple configLearn More org.springframework.ai spring-ai-starter-model-openai spring.ai.openai.api-key=$OPENAI_API_KEYClient Ch
3、at APILearn More private final ChatClient chatClient;public SimpleChatService(ChatClient.Builder chatClientBuilder)this.chatClient=chatClientBuilder.build();public String chat(String message)return this.chatClient.prompt().user(message).call().content();Changed your mind?No problem!Learn More org.sp
4、ringframework.ai spring-ai-starter-model-vertex-ai-gemini spring.ai.vertex.ai.gemini.project-id=$GEM_PROJECT_IDspring.ai.vertex.ai.gemini.location=us-east4MemoryMemoryLearn More public MemoryChatService(ChatClient.Builder chatClientBuilder,JdbcChatMemoryRepository jdbcChatMemoryRepository)ChatMemory
5、 chatMemory=MessageWindowChatMemory.builder().chatMemoryRepository(jdbcChatMemoryRepository).maxMessages(10).build();this.chatClient=chatClientBuilder .defaultAdvisors(MessageChatMemoryAdvisor.builder(chatMemory).build().build();Chat IdLearn More public String chat(String chatId,String message)retur
6、n this.chatClient.prompt().user(message).advisors(a-a.param(ChatMemory.CONVERSATION_ID,chatId).call().content();Personas,Guardrails and SecurityPersonasLearn Morepublic ChatService(ChatClient.Builder chatClientBuilder)final String SYSTEM=You are a customer support agent for SpringFly Airlines .;this