README.md
Spring AI 2.x.x (main branch) - Spring Boot
4.xSpring AI 1.1.x (1.1.x branch) - Spring Boot
3.5.x
The Spring AI project provides a Spring-friendly API and abstractions for developing AI applications.
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.
At its core, Spring AI addresses the fundamental challenge of AI integration: Connecting your enterprise Data and APIs with the AI Models.
The project draws inspiration from notable Python projects, such as LangChain and LlamaIndex, but Spring AI is not a direct port of those projects. The project was founded with the belief that the next wave of Generative AI applications will not be only for Python developers but will be ubiquitous across many programming languages.
You can check out the blog post Why Spring AI for additional motivations.
This is a high level feature overview. You can find more details in the Reference Documentation
Please refer to the Getting Started Guide for instruction on adding your dependencies.
This repository contains large model files. To clone it you have to either:
GIT_LFS_SKIP_SMUDGE=1 git clone [email protected]:spring-projects/spring-ai.git.The project targets and build artifacts compatible with Java 17+, but requires JDK 21 to build. This is enforced by the maven enforcer plugin.
To build with running unit tests
./mvnw clean package
To build including integration tests.
./mvnw clean verify -Pintegration-tests
Note that you should set API key environment variables for OpenAI or other model providers before running. If the API key isn't set for a specific model provider, the integration test is skipped.
To run a specific integration test allowing for up to two attempts to succeed. This is useful when a hosted service is not reliable or times out.
./mvnw -pl vector-stores/spring-ai-pgvector-store -am -Pintegration-tests -Dfailsafe.failIfNoSpecifiedTests=false -Dfailsafe.rerunFailingTestsCount=2 -Dit.test=PgVectorStoreIT verify
There are many integration tests, so it often isn't realistic to run them all at once.
A quick pass through the most important pathways that runs integration tests for
can be done with the profile -Pci-fast-integration-tests and is used in the main CI build of this project.
A full integration test is done twice a day in the Spring AI Integration Test Repository
One way to run integration tests on part of the code is to first do a quick compile and install of the project
./mvnw clean install -DskipTests -Dmaven.javadoc.skip=true
Then run the integration test for a specific module using the -pl option
./mvnw verify -Pintegration-tests -pl spring-ai-spring-boot-testcontainers
To build the docs
./mvnw -pl spring-ai-docs antora
The docs are then in the directory spring-ai-docs/target/antora/site/index.html
The code is formatted using the java-format plugin as part of the build. Correct formatting is enforced by CI.
To update the year on license headers using the license-maven-plugin
./mvnw license:update-file-header -Plicense
To check javadocs using the javadoc:javadoc
./mvnw javadoc:javadoc -Pjavadoc
Spring AI source code checkstyle tries to follow the checkstyle guidelines used by the core Spring Framework project with some exceptions. The wiki pages Code Style and IntelliJ IDEA Editor Settings define the source file coding standards we use along with some IDEA editor settings we customize.
Run checkstyle manually:
./mvnw process-sources -P checkstyle-check
Your contributions are always welcome! Please read the contribution guidelines first.