Spring AI

Use Spring AI with Oracle AI Database to store embeddings, run similarity searches, and persist chat memory from Spring Boot applications.

Spring AI provides abstractions for AI application development in the Spring ecosystem. The Oracle vector store integration implements the Spring AI VectorStore interface, and Spring AI JDBC chat memory can persist conversation context in Oracle AI Database.

Why Spring AI with Oracle AI Database

Oracle AI Database can store application data, metadata, vectors, and chat memory in one database. Spring AI applications can use this capability for retrieval-augmented generation, semantic search, document search, and contextual chat workflows.

Key capabilities of the integration:

Architecture

A typical Spring AI and Oracle AI Database application follows this flow:

  1. Add dependencies: Add the Spring AI Oracle vector store starter and an embedding model starter.
  2. Configure the data source: Set the Oracle JDBC URL, user name, and password.
  3. Configure vector settings: Set dimensions, distance type, index type, and schema initialization.
  4. Inject the vector store: Autowire VectorStore or create an OracleVectorStore bean.
  5. Add documents: Create Spring AI Document instances and add them to the vector store.
  6. Search documents: Run similarity searches, optionally with metadata filters.
  7. Persist chat memory: Configure JDBC chat memory when chat applications need conversation context across calls.

Integration Components

Use the following Spring AI components with Oracle AI Database.

Component Use
spring-ai-starter-vector-store-oracle Spring Boot starter for the Oracle vector store.
OracleVectorStore Oracle implementation of the Spring AI VectorStore interface.
EmbeddingModel Spring AI embedding abstraction used to generate vectors for documents and queries.
SearchRequest Search request builder for query text, result count, similarity threshold, and metadata filters.
FilterExpressionBuilder Programmatic builder for portable metadata filter expressions.
ChatMemory Spring AI abstraction for selected messages that provide conversation context.
JdbcChatMemoryRepository JDBC-backed repository that can persist chat memory in Oracle AI Database.

Resources