Spring AI

Spring AI is an application framework for AI engineering. Its goal is to apply to the AI domain Spring ecosystem design principles such as portability and modular design and promote using POJOs as the building blocks of an application to the AI domain.

spring-ai-integration-diagram-3

At its core, Spring AI addresses the fundamental challenge of AI integration: Connecting your enterprise Data and APIs with the AI Models.

Features

Spring AI provides the following features:

This feature set lets you implement common use cases such as "Q&A over your documentation" or "Chat with your documentation."

Documentation

Extensive reference documentation, sample applications, and workshop/course material.

Getting Started

You can get started in a few simple steps:

  1. Create a Spring Boot Web application with a Spring AI OpenAI boot starter dependency. This Spring Initializr link can help you bootstrap the application. (With start.spring.io you can select any AI Models or Vector Stores that you want to use in your new applications).

  2. Add your OpenAI key to the application.properties:

    spring.ai.openai.api-key=<YOUR OPENAI KEY>
    
  3. Add the following snippet to your SpringAiDemoApplication class:

    @Bean
    public CommandLineRunner runner(ChatClient.Builder builder) {
        return args -> {
            ChatClient chatClient = builder.build();
            String response = chatClient.prompt("Tell me a joke").call().content();							
            System.out.println(response);
        };
    }
    
  4. Run the application:

    ./mvnw spring-boot:run
    

Want to get started in another way? View the Getting Started section in the reference documentation.

Spring Initializr

Quickstart Your Project

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all