clean up README.md and improve getting-started.adoc
This commit is contained in:
257
README.md
257
README.md
@@ -6,238 +6,29 @@ The Spring AI project provides a Spring-friendly API and abstractions for develo
|
||||
|
||||
Let's make your `@Beans` intelligent!
|
||||
|
||||
For further information go to our [Spring AI documentation](https://docs.spring.io/spring-ai/reference/).
|
||||
|
||||
## Project Update
|
||||
|
||||
:partying_face: The Spring AI project has graduated out of the repository!
|
||||
|
||||
:warning:
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
January 24, 2024 Update
|
||||
|
||||
* Moving the `prompt` and `messages` and `metadata` packages to subpackages of `org.sf.ai.chat`
|
||||
* New functionality is **text to image** clients. Classes are `OpenAiImageClient` and `StabilityAiImageClient`. See the integration tests for usage, docs are coming soon.
|
||||
* A new package `model` that contains interfaces and base classes to support creating AI Model Clients for any input/output data type combination. At the moment the chat and image model packages implement this. We will be updating the embedding package to this new model soon.
|
||||
* A new "portable options" design pattern. We wanted to provide as much portability in the `ChatClient` as possible across different chat based AI Models. There is a common set of generation options and then those that are specific to a model provider. A sort of `duck typing` approach is used. `ModelOptions` in the model package is a marker interface indicating implementations of this class will provide the options for a model. See `ImageOptions`, a subinterface that defines portable options across all text->image `ImageClient` implementations. Then `StabilityAiImageOptions` and `OpenAiImageOptions` provide the options specific to each model provider. All options classes are created via a fluent API builder all can be passed into the portable `ImageClient` API. These option data types are using in autoconfiguration/configurationproperties for the `ImageClient` implementations.
|
||||
|
||||
|
||||
January 13, 2024 Update
|
||||
|
||||
The following OpenAi Autoconfiguration chat properties has changed
|
||||
|
||||
- from `spring.ai.openai.model` to `spring.ai.openai.chat.model`.
|
||||
- from `spring.ai.openai.temperature` to `spring.ai.openai.chat.temperature`.
|
||||
|
||||
Find updated documentation about the OpenAi properties: https://docs.spring.io/spring-ai/reference/api/clients/openai.html
|
||||
|
||||
December 27, 2023 Update
|
||||
|
||||
Merge SimplePersistentVectorStore and InMemoryVectorStore into SimpleVectorStore
|
||||
- Replace InMemoryVectorStore with SimpleVectorStore
|
||||
|
||||
December 20, 2023 Update
|
||||
|
||||
Refactor the Ollama client and related classes and package names
|
||||
|
||||
- Replace the org.springframework.ai.ollama.client.OllamaClient by org.springframework.ai.ollama.OllamaChatClient.
|
||||
- The OllamaChatClient method signatures have changed.
|
||||
- Rename the org.springframework.ai.autoconfigure.ollama.OllamaProperties into org.springframework.ai.autoconfigure.ollama.OllamaChatProperties and change the suffix to: `spring.ai.ollama.chat`. Some of the properties have changed as well.
|
||||
|
||||
December 19, 2023 Update
|
||||
|
||||
Renaming of AiClient and related classes and packagenames
|
||||
|
||||
* Rename AiClient to ChatClient
|
||||
* Rename AiResponse to ChatResponse
|
||||
* Rename AiStreamClient to StreamingChatClient
|
||||
* Rename package org.sf.ai.client to org.sf.ai.chat
|
||||
|
||||
Rename artifact ID of
|
||||
|
||||
* `transformers-embedding` to `spring-ai-transformers`
|
||||
|
||||
Moved Maven modules from top level directoryand `embedding-clients` subdirectory to all be under a single `models` directory.
|
||||
|
||||
:warning:
|
||||
|
||||
December 1, 2023
|
||||
|
||||
We are transitioning the project's Group ID:
|
||||
|
||||
* **FROM**: `org.springframework.experimental.ai`
|
||||
* **TO**: `org.springframework.ai`
|
||||
|
||||
Artifacts will still be hosted in the snapshot repository as shown below.
|
||||
|
||||
The main branch will move to the version `0.8.0-SNAPSHOT`.
|
||||
It will be unstable for a week or two.
|
||||
Please use the 0.7.1-SNAPSHOT if you don't want to be on the bleeding edge.
|
||||
|
||||
You can access `0.7.1-SNAPSHOT` artifacts as before and still access [0.7.1-SNAPSHOT Documentation](https://markpollack.github.io/spring-ai-0.7.1/).
|
||||
|
||||
|
||||
## Cloning the repo
|
||||
|
||||
This repository contains [large model files](https://github.com/spring-projects/spring-ai/tree/main/models/spring-ai-transformers/src/main/resources/onnx/all-MiniLM-L6-v2).
|
||||
To clone it you have to either:
|
||||
|
||||
- Ignore the large files (won't affect the spring-ai behaviour) : `GIT_LFS_SKIP_SMUDGE=1 git clone git@github.com:spring-projects/spring-ai.git`.
|
||||
- Or install the [Git Large File Storage](https://git-lfs.com/) before cloning the repo.
|
||||
For further information go to our [Spring AI refernce documentation](https://docs.spring.io/spring-ai/reference/).
|
||||
|
||||
## Project Links
|
||||
|
||||
* [Documentation](https://docs.spring.io/spring-ai/reference/)
|
||||
* [Issues](https://github.com/spring-projects/spring-ai/issues)
|
||||
* [Discussions](https://github.com/spring-projects/spring-ai/discussions) - Go here if you have a question, suggestion, or feedback!
|
||||
* [JavaDocs](https://docs.spring.io/spring-ai/docs/current-SNAPSHOT/)
|
||||
* [Upgrade from 0.7.1-SNAPSHOT](https://docs.spring.io/spring-ai/reference/upgrade-notes.html)
|
||||
|
||||
## Educational Resources
|
||||
|
||||
* Follow the [Workshop](#workshop)
|
||||
- Follow the [Workshop](#workshop)
|
||||
- The workshop contains step-by-step examples from 'hello world' to 'retrieval augmented generation'
|
||||
|
||||
Some selected videos. Search YouTube! for more.
|
||||
|
||||
- Spring Tips: Spring AI
|
||||
<br>[](https://www.youtube.com/watch?v=aNKDoiOUo9M)
|
||||
* Overview of Spring AI @ Devoxx 2023
|
||||
<br>[](https://www.youtube.com/watch?v=7OY9fKVxAFQ)
|
||||
* Introducing Spring AI - Add Generative AI to your Spring Applications
|
||||
<br>[](https://www.youtube.com/watch?v=1g_wuincUdU)
|
||||
|
||||
## Dependencies
|
||||
|
||||
The Spring AI project provides artifacts in the Spring Milestone Repository.
|
||||
You will need to add configuration to add a reference to the Spring Milestone repository in your build file.
|
||||
For example, in maven, add the following repository definition.
|
||||
|
||||
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
|
||||
And the Spring Boot Starter depending on if you are using Azure Open AI or Open AI.
|
||||
|
||||
### Main Branch
|
||||
|
||||
The main branch has move to version 0.8.0-SNAPSHOT.
|
||||
It will be unstable for a week or two.
|
||||
Please use the 0.7.1-SNAPSHOT if you don't want to be on the bleeding edge.
|
||||
|
||||
* Azure OpenAI
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
* OpenAI
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### 0.7.1-SNAPSHOT
|
||||
|
||||
* Azure OpenAI
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.experimental.ai</groupId>
|
||||
<artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId>
|
||||
<version>0.7.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
* OpenAI
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.experimental.ai</groupId>
|
||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||
<version>0.7.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
### Vector Stores
|
||||
|
||||
Following vector stores are supported:
|
||||
|
||||
* Azure Vector Store
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-azure-vector-store-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
* Chroma
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-chroma-store-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
* Milvus
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-milvus-store-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
* PGVector
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-pgvector-store-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
* Pinecone
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-pinecone-store-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
* Weaviate
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-weaviate-store-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
* Neo4j
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-neo4j-store-spring-boot-starter</artifactId>
|
||||
<version>0.8.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## Workshop
|
||||
|
||||
@@ -251,6 +42,24 @@ Following vector stores are supported:
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please refer to the [Getting Started Guide](https://docs.spring.io/spring-ai/reference/getting-started.html) for instruction on adding your dependencies.
|
||||
|
||||
Note, the new Spring CLI project lets you get up and running in two simple steps, [described in detail here](https://docs.spring.io/spring-ai/reference/getting-started.html#spring-cli).
|
||||
1. Install Spring CLI
|
||||
2. Type `spring boot new --from ai --name myai` in your terminal
|
||||
|
||||
|
||||
### Adding Dependencies manually
|
||||
|
||||
Note that are two main steps.
|
||||
|
||||
1. [Add the Spring Milestone and Snapshot repositories to your build system](https://docs.spring.io/spring-ai/reference/getting-started.html#repositories).
|
||||
2. Add the [Spring AI BOM](https://docs.spring.io/spring-ai/reference/getting-started.html#dependency-management)
|
||||
3. [Add dependencies](https://docs.spring.io/spring-ai/reference/getting-started.html#add-dependencies) for the specific AI model, Vector Database or other component dependencies you require.
|
||||
|
||||
|
||||
## Overview
|
||||
|
||||
Despite the extensive history of AI, Java's role in this domain has been relatively minor.
|
||||
@@ -354,6 +163,17 @@ Though the `DocumentWriter` interface isn't exclusively for Vector Database writ
|
||||
They ascertain which document sections the AI should use for generating responses.
|
||||
Examples of Vector Databases include Chroma, Postgres, Pinecone, Weaviate, Mongo Atlas, and Redis. Spring AI's `VectorStore` abstraction permits effortless transitions between database implementations.
|
||||
|
||||
|
||||
|
||||
## Cloning the repo
|
||||
|
||||
This repository contains [large model files](https://github.com/spring-projects/spring-ai/tree/main/models/spring-ai-transformers/src/main/resources/onnx/all-MiniLM-L6-v2).
|
||||
To clone it you have to either:
|
||||
|
||||
- Ignore the large files (won't affect the spring-ai behaviour) : `GIT_LFS_SKIP_SMUDGE=1 git clone git@github.com:spring-projects/spring-ai.git`.
|
||||
- Or install the [Git Large File Storage](https://git-lfs.com/) before cloning the repo.
|
||||
|
||||
|
||||
## Building
|
||||
|
||||
To build with running unit tests
|
||||
@@ -380,3 +200,4 @@ To build the docs
|
||||
```
|
||||
|
||||
The docs are then in the directory `spring-ai-docs/target/antora/site/index.html`
|
||||
|
||||
|
||||
@@ -42,4 +42,4 @@
|
||||
** xref:api/etl-pipeline.adoc[]
|
||||
** xref:api/testing.adoc[]
|
||||
* Appendices
|
||||
** xref:glossary.adoc[]
|
||||
** xref:upgrade-notes.adoc[]]
|
||||
|
||||
@@ -3,129 +3,9 @@
|
||||
|
||||
This section offers jumping off points for how to get started using Spring AI.
|
||||
|
||||
[#_dependency_management]
|
||||
== Dependency Management
|
||||
|
||||
The Spring AI project provides artifacts in the Spring Milestone and Snapshot repositories.
|
||||
|
||||
=== 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 application’s build script avoids the need for you to specify and maintain the dependency versions yourself.
|
||||
Instead, the version of the BOM you’re using determines the utilized dependency versions.
|
||||
It also ensures that you’re using supported and tested versions of the dependencies by default, unless you choose to override them.
|
||||
|
||||
If you’re 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:
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
----
|
||||
|
||||
For Gradle, add the following repository definitions as needed:
|
||||
|
||||
[source,groovy]
|
||||
----
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
}
|
||||
----
|
||||
|
||||
== 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)
|
||||
|
||||
== Image Generation Models
|
||||
* xref:api/imageclient.adoc[]
|
||||
** xref:api/clients/image/openai-image.adoc[OpenAI Image Generation]
|
||||
** xref:api/clients/image/stabilityai-image.adoc[StabilityAI Image Generation]
|
||||
|
||||
== 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 (in-memory) implementation of persistent vector storage, good for educational purposes.
|
||||
|
||||
You should follow the steps in each of the following section according to your needs.
|
||||
|
||||
[[spring-cli]]
|
||||
== Spring CLI
|
||||
|
||||
The Spring CLI makes it easy to create new applications with code in your terminal window. Think of it as the 'create-react-app' of Spring for those familiar with the JavaScript ecosystem.
|
||||
@@ -138,13 +18,13 @@ Create a simple AI application:
|
||||
* For OpenAI
|
||||
|
||||
```shell
|
||||
spring boot new ai
|
||||
spring boot new --from ai --name myai
|
||||
```
|
||||
|
||||
* For Azure OpenAI
|
||||
|
||||
```shell
|
||||
spring boot new ai-azure
|
||||
spring boot new --from ai-azure --name myai
|
||||
```
|
||||
|
||||
You can also add the same simple AI application to your current project by using:
|
||||
@@ -198,6 +78,135 @@ spring project list
|
||||
└──────────────────────────┴───────────────┴────────────────────────────────────────────────────────────────────┴────────┴───────────────┘
|
||||
```
|
||||
|
||||
[[repositories]]
|
||||
== Add Milestone and Snapshot Repositories
|
||||
|
||||
If you would prefer to add the dependency snippets by hand, follow the directions in the following secitons.
|
||||
|
||||
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:
|
||||
|
||||
[source,xml]
|
||||
----
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
----
|
||||
|
||||
For Gradle, add the following repository definitions as needed:
|
||||
|
||||
[source,groovy]
|
||||
----
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
maven { url 'https://repo.spring.io/snapshot' }
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
[[dependency-management]]
|
||||
== Dependency Management
|
||||
|
||||
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 application’s build script avoids the need for you to specify and maintain the dependency versions yourself.
|
||||
Instead, the version of the BOM you’re using determines the utilized dependency versions.
|
||||
It also ensures that you’re using supported and tested versions of the dependencies by default, unless you choose to override them.
|
||||
|
||||
If you’re 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'
|
||||
}
|
||||
----
|
||||
|
||||
[[add-dependencies]]
|
||||
== Add dependencies for specific components
|
||||
|
||||
Each of the following sections in the documentation shows which dependnecies you need to add to your project build system.
|
||||
|
||||
=== 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)
|
||||
|
||||
=== Image Generation Models
|
||||
* xref:api/imageclient.adoc[]
|
||||
** xref:api/clients/image/openai-image.adoc[OpenAI Image Generation]
|
||||
** xref:api/clients/image/stabilityai-image.adoc[StabilityAI Image Generation]
|
||||
|
||||
=== 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 (in-memory) implementation of persistent vector storage, good for educational purposes.
|
||||
|
||||
|
||||
== Sample Projects
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
[[upgrade-notes]]
|
||||
= Upgrading to 0.8.0
|
||||
|
||||
== January 24, 2024 Update
|
||||
|
||||
* Moving the `prompt` and `messages` and `metadata` packages to subpackages of `org.sf.ai.chat`
|
||||
* New functionality is *text to image* clients. Classes are `OpenAiImageClient` and `StabilityAiImageClient`. See the integration tests for usage, docs are coming soon.
|
||||
* A new package `model` that contains interfaces and base classes to support creating AI Model Clients for any input/output data type combination. At the moment the chat and image model packages implement this. We will be updating the embedding package to this new model soon.
|
||||
* A new "portable options" design pattern. We wanted to provide as much portability in the `ChatClient` as possible across different chat based AI Models. There is a common set of generation options and then those that are specific to a model provider. A sort of "duck typing" approach is used. `ModelOptions` in the model package is a marker interface indicating implementations of this class will provide the options for a model. See `ImageOptions`, a subinterface that defines portable options across all text->image `ImageClient` implementations. Then `StabilityAiImageOptions` and `OpenAiImageOptions` provide the options specific to each model provider. All options classes are created via a fluent API builder all can be passed into the portable `ImageClient` API. These option data types are using in autoconfiguration/configuration properties for the `ImageClient` implementations.
|
||||
|
||||
== January 13, 2024 Update
|
||||
|
||||
The following OpenAi Autoconfiguration chat properties has changed
|
||||
|
||||
* from `spring.ai.openai.model` to `spring.ai.openai.chat.model`.
|
||||
* from `spring.ai.openai.temperature` to `spring.ai.openai.chat.temperature`.
|
||||
|
||||
Find updated documentation about the OpenAi properties: https://docs.spring.io/spring-ai/reference/api/clients/openai.html
|
||||
|
||||
== December 27, 2023 Update
|
||||
|
||||
Merge SimplePersistentVectorStore and InMemoryVectorStore into SimpleVectorStore
|
||||
* Replace InMemoryVectorStore with SimpleVectorStore
|
||||
|
||||
== December 20, 2023 Update
|
||||
|
||||
Refactor the Ollama client and related classes and package names
|
||||
|
||||
* Replace the org.springframework.ai.ollama.client.OllamaClient by org.springframework.ai.ollama.OllamaChatClient.
|
||||
* The OllamaChatClient method signatures have changed.
|
||||
* Rename the org.springframework.ai.autoconfigure.ollama.OllamaProperties into org.springframework.ai.autoconfigure.ollama.OllamaChatProperties and change the suffix to: `spring.ai.ollama.chat`. Some of the properties have changed as well.
|
||||
|
||||
== December 19, 2023 Update
|
||||
|
||||
Renaming of AiClient and related classes and package names
|
||||
|
||||
* Rename AiClient to ChatClient
|
||||
* Rename AiResponse to ChatResponse
|
||||
* Rename AiStreamClient to StreamingChatClient
|
||||
* Rename package org.sf.ai.client to org.sf.ai.chat
|
||||
|
||||
Rename artifact ID of
|
||||
|
||||
* `transformers-embedding` to `spring-ai-transformers`
|
||||
|
||||
Moved Maven modules from top-level directory and `embedding-clients` subdirectory to all be under a single `models` directory.
|
||||
|
||||
[WARNING]
|
||||
|
||||
== December 1, 2023
|
||||
|
||||
We are transitioning the project's Group ID:
|
||||
|
||||
* *FROM*: `org.springframework.experimental.ai`
|
||||
* *TO*: `org.springframework.ai`
|
||||
|
||||
Artifacts will still be hosted in the snapshot repository as shown below.
|
||||
|
||||
The main branch will move to the version `0.8.0-SNAPSHOT`.
|
||||
It will be unstable for a week or two.
|
||||
Please use the 0.7.1-SNAPSHOT if you don't want to be on the bleeding edge.
|
||||
|
||||
You can access `0.7.1-SNAPSHOT` artifacts as before and still access https://markpollack.github.io/spring-ai-0.7.1/[0.7.1-SNAPSHOT Documentation].
|
||||
|
||||
== 0.7.1-SNAPSHOT Dependencies
|
||||
|
||||
* Azure OpenAI
|
||||
+
|
||||
[source,xml]
|
||||
----
|
||||
<dependency>
|
||||
<groupId>org.springframework.experimental.ai</groupId>
|
||||
<artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId>
|
||||
<version>0.7.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
----
|
||||
|
||||
* OpenAI
|
||||
+
|
||||
[source,xml]
|
||||
----
|
||||
<dependency>
|
||||
<groupId>org.springframework.experimental.ai</groupId>
|
||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||
<version>0.7.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user