Add spring AI Bom and related docs

This commit is contained in:
Christian Tzolov
2024-02-13 13:38:24 +01:00
parent 0334e6d428
commit cb12512775
4 changed files with 342 additions and 24 deletions

View File

@@ -13,6 +13,7 @@
<description>Building AI applications with Spring Boot</description>
<modules>
<module>spring-ai-bom</module>
<module>spring-ai-core</module>
<module>models/spring-ai-transformers</module>
<module>models/spring-ai-postgresml</module>
@@ -51,7 +52,6 @@
<module>vector-stores/spring-ai-redis</module>
<module>spring-ai-spring-boot-starters/spring-ai-starter-vertex-ai</module>
<module>spring-ai-spring-boot-starters/spring-ai-starter-bedrock-ai</module>
</modules>
<organization>

260
spring-ai-bom/pom.xml Normal file
View File

@@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai</artifactId>
<version>0.8.0-SNAPSHOT</version>
</parent>
<artifactId>spring-ai-bom</artifactId>
<packaging>pom</packaging>
<name>Spring AI BOM</name>
<description>Bill of Materials POM (BOM) for the Spring AI modules</description>
<url>https://github.com/spring-projects/spring-ai</url>
<scm>
<url>https://github.com/spring-projects/spring-ai</url>
<connection>git://github.com/spring-projects/spring-ai.git</connection>
<developerConnection>git@github.com:spring-projects/spring-ai.git</developerConnection>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Document Readers -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-pdf-document-reader</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-tika-document-reader</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Models -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-azure-openai</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-bedrock</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-huggingface</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-ollama</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-openai</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-postgresml</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-stability-ai</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-transformers</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-vertex-ai</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Vector Databses -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-azure-vector-store</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-chroma-store</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-milvus-store</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-neo4j-store</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-pgvector-store</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-pinecone</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-redis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-weaviate-store</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Utilities -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-test</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-spring-boot-autoconfigure</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Spring Boog Starters -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-azure-vector-store-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-bedrock-ai-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-chroma-store-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-milvus-store-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-neo4j-store-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-ollama-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-pgvector-store-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-pinecone-store-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-postgresml-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-redis-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-transformers-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-vertex-ai-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-weaviate-store-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@@ -179,17 +179,16 @@ The `ChatClient` and `StreamingChatClient` implementations are provided for the
image::spring-ai-chat-completions-clients.jpg[align="center", width="800px"]
* link:clients/openai-chat.html[OpenAI Chat Completion]
* link:clients/azure-openai-chat.html[Microsoft Azure Open AI Chat Completion]
* link:clients/ollama-chat.html[Ollama Chat Completion]
* link:clients/huggingface.html[HuggingFace Chat Completion] (no streaming support)
* link:clients/vertex-chat.html[Google Vertex Chat Completion] (no streaming support)
* link:clients/bedrock.html[Amazon Bedrock]
** link:clients/bedrock/bedrock-cohere.html[Cohere Chat Completion]
** link:clients/bedrock/bedrock-llama2.html[Llama2 Chat Completion]
** link:clients/bedrock/bedrock-titan.html[Titan Chat Completion]
** link:clients/bedrock/bedrock-anthropic.html[Anthropic Chat Completion]
** link:clients/bedrock/bedrock-jurassic.html[Jurassic2 Chat Completion] (WIP, no streaming support)
* xref:api/clients/openai-chat.adoc[OpenAI Chat Completion]
* xref:api/clients/azure-openai-chat.adoc[Microsoft Azure Open AI Chat Completion]
* xref:api/clients/ollama-chat.adoc[Ollama Chat Completion]
* xref:api/clients/huggingface.adoc[HuggingFace Chat Completion] (no streaming support)
* xref:api/clients/vertexai-chat.adoc[Google Vertex Chat Completion] (no streaming support)
* xref:api/bedrock.adoc[Amazon Bedrock]
** xref:api/clients/bedrock/bedrock-cohere.adoc[Cohere Chat Completion]
** xref:api/clients/bedrock/bedrock-llama2.adoc[Llama2 Chat Completion]
** xref:api/clients/bedrock/bedrock-titan.adoc[Titan Chat Completion]
** xref:api/clients/bedrock/bedrock-anthropic.adoc[Anthropic Chat Completion]
// == Best Practices
//

View File

@@ -7,7 +7,44 @@ This section offers jumping off points for how to get started using Spring AI.
The Spring AI project provides artifacts in the Spring Milestone and Snapshot repositories.
You need to add references to the Spring Milestone and/or Snapshot repositories in your build file.
=== Bill of Materials
The Spring AI Bill of Materials (BOM) declares the recommended versions of all the dependencies used by a given release of Spring AI.
Using the BOM from your applications build script avoids the need for you to specify and maintain the dependency versions yourself.
Instead, the version of the BOM youre using determines the utilized dependency versions.
It also ensures that youre using supported and tested versions of the dependencies by default, unless you choose to override them.
If youre a Maven user, you can use the BOM by adding the following to your pom.xml file -
[source,xml]
----
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-bom</artifactId>
<version>{project-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
----
Gradle users can also use the Spring AI BOM by leveraging Gradle (5.0+) native support for declaring dependency constraints using a Maven BOM.
This is implemented by adding a 'platform' dependency handler method to the dependencies section of your Gradle build script.
As shown in the snippet below this can then be followed by version-less declarations of the Starter Dependencies for the one or more spring-ai modules you wish to use, e.g. spring-ai-openai.
[source,gradle]
----
dependencies {
implementation platform("org.springframework.ai:spring-ai-bom:${springAiVersion}")
// Replace the following with the starter dependencies of specific modules you wish to use
implementation 'org.springframework.ai:spring-ai-openai'
}
----
To use the Milestone and Snapshot version, you need to add references to the Spring Milestone and/or Snapshot repositories in your build file.
For Maven, add the following repository definitions as needed:
@@ -44,23 +81,45 @@ repositories {
}
----
== Embeddings Models
* xref:api/embeddings.adoc[Embeddings API]
** xref:api/embeddings/openai-embeddings.adoc[Spring AI OpenAI Embeddings]
** xref:api/embeddings/azure-openai-embeddings.adoc[Spring AI Azure OpenAI Embeddings]
** xref:api/embeddings/ollama-embeddings.adoc[Spring AI Ollama Embeddings]
** xref:api/embeddings/onnx.adoc[Spring AI Transformers (ONNX) Embeddings]
** xref:api/embeddings/postgresml-embeddings.adoc[Spring AI PostgresML Embeddings]
** xref:api/embeddings/bedrock-cohere-embedding.adoc[Spring AI Bedrock Cohere Embeddings]
** xref:api/embeddings/bedrock-titan-embedding.adoc[Spring AI Bedrock Titan Embeddings]
** xref:api/embeddings/vertexai-embeddings.adoc[Spring AI VertexAI Embeddings]
== Chat Models
* xref:api/chatclient.adoc[Chat Completion API]
** xref:api/clients/openai-chat.adoc[OpenAI Chat Completion]
** xref:api/clients/azure-openai-chat.adoc[Microsoft Azure Open AI Chat Completion]
** xref:api/clients/ollama-chat.adoc[Ollama Chat Completion]
** xref:api/clients/huggingface.adoc[HuggingFace Chat Completion] (no streaming support)
** xref:api/clients/vertexai-chat.adoc[Google Vertex Chat Completion] (no streaming support)
** xref:api/bedrock.adoc[Amazon Bedrock]
*** xref:api/clients/bedrock/bedrock-cohere.adoc[Cohere Chat Completion]
*** xref:api/clients/bedrock/bedrock-llama2.adoc[Llama2 Chat Completion]
*** xref:api/clients/bedrock/bedrock-titan.adoc[Titan Chat Completion]
*** xref:api/clients/bedrock/bedrock-anthropic.adoc[Anthropic Chat Completion]
// ** xref:api/clients/bedrock/bedrock-jurassic.adoc[Jurassic2 Chat Completion] (WIP, no streaming support)
* xref:api/clients/openai-chat.adoc[OpenAI]
* xref:api/clients/azure-openai-chat.adoc[Azure OpenAI]
* xref:api/clients/huggingface.adoc[HuggingFace]
* xref:api/bedrock.adoc[Bedrock]
* xref:api/clients/ollama-chat.adoc[Ollama]
== Embedding Models
== Vector Databases
* xref:api/vectordbs.adoc[Vector Database API]
** xref:api/vectordbs/azure.adoc[ Azure Vector Search] - The https://learn.microsoft.com/en-us/azure/search/vector-search-overview[Azure] vector store.
** xref:api/vectordbs/chroma.adoc[ChromaVectorStore] - The https://www.trychroma.com/[Chroma] vector store.
** xref:api/vectordbs/milvus.adoc[MilvusVectorStore] - The https://milvus.io/[Milvus] vector store.
** xref:api/vectordbs/neo4j.adoc[Neo4jVectorStore] - The https://neo4j.com/[Neo4j] vector store.
** xref:api/vectordbs/pgvector.adoc[PgVectorStore] - The https://github.com/pgvector/pgvector[PostgreSQL/PGVector] vector store.
** xref:api/vectordbs/pinecone.adoc[PineconeVectorStore] - https://www.pinecone.io/[PineCone] vector store.
** xref:api/vectordbs/redis.adoc[RedisVectorStore] - The https://redis.io/[Redis] vector store.
** xref:api/vectordbs/weaviate.adoc[WeaviateVectorStore] - The https://weaviate.io/[Weaviate] vector store.
** link:https://github.com/spring-projects/spring-ai/blob/main/spring-ai-core/src/main/java/org/springframework/ai/vectorstore/SimpleVectorStore.java[SimpleVectorStore] - A simple implementation of persistent vector storage, good for educational purposes.
* xref:api/embeddings/openai-embeddings.adoc[OpenAI Embeddings]
* xref:api/embeddings/azure-openai-embeddings.adoc[Azure OpenAI Embeddings]
* xref:api/embeddings/ollama-embeddings.adoc[Ollama Embeddings]
* xref:api/embeddings/onnx.adoc[Transformers (ONNX) Embeddings]
* xref:api/embeddings/postgresml-embeddings.adoc[PostgresML Embeddings]
== Spring CLI