Spring AI is an application framework for Java that provides a portable, fluent API for integrating AI models, tools, and vector stores into applications. It wraps multiple AI providers behind a common interface, allowing developers to switch between chat, embedding, image, and speech models without changing application code. The framework includes a chainable chat client API similar to WebClient or RestClient, supports both synchronous and streaming interactions, and offers structured output conversion that transforms unstructured AI responses into strongly-typed Java objects.
The framework distinguishes itself through its tool calling capabilities, which allow AI models to invoke client-side Java methods during conversations, with support for dynamic resolution, lifecycle management, and annotation-driven registration. It implements the Model Context Protocol (MCP) to establish a standardized bridge between AI models and external services for tool and resource discovery. Spring AI also provides a retrieval-augmented generation (RAG) pipeline that combines document retrieval from vector stores with language model generation, and an advisor framework that encapsulates recurring patterns like memory, tool-calling, and RAG into reusable interceptors.
Beyond core AI interactions, the framework handles document processing by loading, chunking, and enriching documents from structured files, and manages vector embeddings across multiple database providers with metadata filtering. It includes content moderation capabilities to inspect AI output against safety policies, and provides observability through logging, tracing, and evaluation utilities that assess response quality and detect hallucinations. The framework supports audio transcription, image generation, and speech synthesis through portable APIs, and manages conversation history across sessions using pluggable persistent backends.
Spring AI bootstraps AI model and vector store connections automatically using Spring Boot starters and dependency-driven configuration, with project skeletons available through Spring Initializr.