Cloud Bindings

Spring AI 支持基于 spring-cloud-bindings 基础的云绑定。这允许应用程序为提供程序指定绑定类型,然后使用通用格式表达属性。spring-ai 云绑定将处理这些属性并将它们绑定到 spring-ai 本机属性。

Spring AI provides support for cloud bindings based on the foundations in spring-cloud-bindings. This allows applications to specify a binding type for a provider and then express properties using a generic format. The spring-ai cloud bindings will process these properties and bind them to spring-ai native properties.

例如,当使用 OpenAi 时,绑定类型为 openai 。使用属性 spring.ai.cloud.bindings.openai.enabled ,可以启用或禁用绑定处理器。默认情况下,当指定绑定类型时,此属性将被启用。可以指定 api-keyuriusernamepassword 等的配置,spring-ai 将它们映射到支持系统中的相应属性。

For example, when using OpenAi, the binding type is openai. Using the property spring.ai.cloud.bindings.openai.enabled, the binding processor can be enabled or disabled. By default, when specifying a binding type, this property will be enabled. Configuration for api-key, uri, username, password, etc. can be specified and spring-ai will map them to the corresponding properties in the supported system.

要启用云绑定支持,请在应用程序中包含以下依赖项。

To enable cloud binding support, include the following dependency in the application.

<dependency>
   <groupId>org.springframework.ai</groupId>
   <artifactId>spring-ai-spring-cloud-bindings</artifactId>
</dependency>

或添加到 Gradle build.gradle 构建文件中。

or to your Gradle build.gradle build file.

dependencies {
    implementation 'org.springframework.ai:spring-ai-spring-cloud-bindings'
}
  1. 参见 Dependency Management 部分,将 Spring AI BOM 添加到你的构建文件中。

Refer to the Dependency Management section to add the Spring AI BOM to your build file.

Available Cloud Bindings

以下是 spring-ai-spring-clou-bindings 模块中当前支持云绑定的组件:

The following are the components for which the cloud binding support is currently available in the spring-ai-spring-clou-bindings module:

Service Type

Binding Type

Source Properties

Target Properties

Chroma Vector Store

chroma

uri, username, passwor

spring.ai.vectorstore.chroma.client.host, spring.ai.vectorstore.chroma.client.port, spring.ai.vectorstore.chroma.client.username, spring.ai.vectorstore.chroma.client.host.password

Mistral AI

mistralai

api-key, uri

spring.ai.mistralai.api-key, spring.ai.mistralai.base-url

Ollama

ollama

uri

spring.ai.ollama.base-url

OpenAi

openai

api-key, uri

spring.ai.openai.api-key, spring.ai.openai.base-url

Weaviate

weaviate

uri, api-key

spring.ai.vectorstore.weaviate.scheme, spring.ai.vectorstore.weaviate.host, spring.ai.vectorstore.weaviate.api-key

Tanzu GenAI

genai

uri, api-key, model-capabilities (chat and embedding), model-name

spring.ai.openai.chat.base-url, , spring.ai.openai.chat.api-key`, spring.ai.openai.chat.options.model, spring.ai.openai.embedding.base-url, , spring.ai.openai.embedding.api-key`, spring.ai.openai.embedding.options.model