升级 Notes
升级到 1.0.0.M2
-
Chroma Vector Store 的配置前缀已从
spring.ai.vectorstore.chroma.store
自spring.ai.vectorstore.chroma
为了与其他 Vector Store 的命名约定保持一致。 -
的
initialize-schema
能够初始化 Schema 的 vector store 上的属性现在设置为false
. 这意味着,如果需要在应用程序启动时创建架构,则应用程序现在需要在支持的向量存储上显式选择加入架构初始化。 并非所有 vector store 都支持此属性。 有关更多详细信息,请参阅相应的 vector store 文档。 以下是目前不支持initialize-schema
财产。-
汉娜
-
Pinecone
-
Weaviate
-
-
在 Bedrock Jurassic 2 中,聊天选项
countPenalty
,frequencyPenalty
和presencePenalty
已重命名为countPenaltyOptions
,frequencyPenaltyOptions
和presencePenaltyOptions
. 此外,聊天选项的类型stopSequences
已从String[]
自List<String>
. -
在 Azure OpenAI 中,聊天选项的类型
frequencyPenalty
和presencePenalty
已从Double
自Float
,与所有其他实现一致。
升级到 1.0.0.M1
在发布 1.0.0 M1 的过程中,我们进行了几项重大更改。抱歉,这是最好的!
ChatClient 更改
进行了一次重大更改,将“旧的”ChatClient
并将功能移至ChatModel
.“新”ChatClient
现在采用ChatModel
.这样做是为了支持一个 Fluent API,用于以类似于 Spring 生态系统中其他客户端类的样式创建和执行提示,例如RestClient
,WebClient
和JdbcClient
.有关 Fluent API 的更多信息,请参阅 [JavaDoc](docs.spring.io/spring-ai/docs/api),适当的参考文档即将发布。
我们将 'old' 重命名为ModelClient
自Model
并重命名了实现类,例如ImageClient
已重命名为ImageModel
.这Model
implementation 表示在 Spring AI API 和底层 AI 模型 API 之间进行转换的可移植性层。
适应变化
这ChatClient class 现在位于软件包中org.springframework.ai.chat.client
|
方法 1
现在,无需获取 AutoconfiguredChatClient
实例,您将获得一个ChatModel
实例。这call
重命名后的方法签名保持不变。
要适应您的代码,您应该重构您的代码以更改ChatClient
自ChatModel
以下是更改前的现有代码示例
@RestController
public class OldSimpleAiController {
private final ChatClient chatClient;
public OldSimpleAiController(ChatClient chatClient) {
this.chatClient = chatClient;
}
@GetMapping("/ai/simple")
Map<String, String> completion(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) {
return Map.of("generation", this.chatClient.call(message));
}
}
现在,在更改之后,这将是
@RestController
public class SimpleAiController {
private final ChatModel chatModel;
public SimpleAiController(ChatModel chatModel) {
this.chatModel = chatModel;
}
@GetMapping("/ai/simple")
Map<String, String> completion(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) {
return Map.of("generation", this.chatModel.call(message));
}
}
重命名也适用于类
*StreamingChatClient →StreamingChatModel
* EmbeddingClient →EmbeddingModel
* ImageClient →ImageModel
* SpeechClient →SpeechModel * 和其他类似<XYZ>Client 类 |
方法 2
在此方法中,您将使用“new”上提供的新 Fluent APIChatClient
以下是更改前的现有代码示例
@RestController
class OldSimpleAiController {
ChatClient chatClient;
OldSimpleAiController(ChatClient chatClient) {
this.chatClient = chatClient;
}
@GetMapping("/ai/simple")
Map<String, String> completion(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) {
return Map.of(
"generation",
this.chatClient.call(message)
);
}
}
现在,在更改之后,这将是
@RestController
class SimpleAiController {
private final ChatClient chatClient;
SimpleAiController(ChatClient.Builder builder) {
this.chatClient = builder.build();
}
@GetMapping("/ai/simple")
Map<String, String> completion(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) {
return Map.of(
"generation",
this.chatClient.prompt().user(message).call().content()
);
}
}
这ChatModel 实例 通过 Autoconfiguration 提供给您。 |
方法 3
GitHub 存储库中有一个名为 [v1.0.0-SNAPSHOT-before-chatclient-changes](github.com/spring-projects/spring-ai/tree/v1.0.0-SNAPSHOT-before-chatclient-changes) 的标记,您可以签出该标记并执行本地构建,以避免在准备好迁移代码库之前更新任何代码。
git checkout tags/v1.0.0-SNAPSHOT-before-chatclient-changes
./mvnw clean install -DskipTests
构件名称更改
重命名了 POM 构件名称: - spring-ai-qdrant → spring-ai-qdrant-store - spring-ai-cassandra → spring-ai-cassandra-store - spring-ai-pinecone → spring-ai-pinecone-store - spring-ai-redis → spring-ai-redis-store - spring-ai-qdrant → spring-ai-qdrant-store - spring-ai-gemfire → spring-ai-gemfire-store - spring-ai-azure-vector-store-spring-boot-starter → spring-ai-azure-store-spring-boot-starter - spring-ai-redis-spring-boot-starter → spring-ai-redis-store-spring-boot-starter
升级到 0.8.1
前spring-ai-vertex-ai
已重命名为spring-ai-vertex-ai-palm2
和spring-ai-vertex-ai-spring-boot-starter
已重命名为spring-ai-vertex-ai-palm2-spring-boot-starter
.
因此,您需要将依赖项从
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-vertex-ai</artifactId>
</dependency>
自
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-vertex-ai-palm2</artifactId>
</dependency>
并且 Palm2 型号的相关 Boot starter 已从
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-vertex-ai-spring-boot-starter</artifactId>
</dependency>
自
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-vertex-ai-palm2-spring-boot-starter</artifactId>
</dependency>
-
重命名的类 (01.03.2024)
-
VertexAiApi → VertexAiPalm2Api
-
VertexAiClientChat → VertexAiPalm2ChatClient
-
VertexAiEmbeddingClient → VertexAiPalm2EmbeddingClient
-
VertexAiChatOptions → VertexAiPalm2ChatOptions
-
升级到 0.8.0
2024 年 1 月 24 日更新
-
将
prompt
和messages
和metadata
packages 的子软件包org.sf.ai.chat
-
新功能是文本到图像客户端。类是
OpenAiImageModel
和StabilityAiImageModel
.有关用法,请参阅集成测试,文档即将推出。 -
新软件包
model
其中包含接口和基类,以支持为任何输入/输出数据类型组合创建 AI 模型客户端。目前,chat 和 image model 包实现了这一点。我们很快就会将 embedding 包更新到这个新模型。 -
新的 “portable options” 设计模式。我们希望在
ModelCall
尽可能跨不同的基于聊天的 AI 模型。有一组通用的生成选项,然后是特定于模型提供程序的选项。使用了一种 “duck typing” 方法。ModelOptions
在 model 包中是一个 marker 接口,指示此类的实现将为模型提供选项。看ImageOptions
,一个定义所有 text→image 的可移植选项的子接口ImageModel
实现。然后StabilityAiImageOptions
和OpenAiImageOptions
提供特定于每个模型提供程序的选项。所有选项类都是通过 Fluent API 构建器创建的,都可以传递到可移植的ImageModel
应用程序接口。这些选项数据类型在 autoconfiguration/configuration 属性中使用ImageModel
实现。
2024 年 1 月 13 日更新
以下 OpenAi 自动配置聊天属性已更改
-
从
spring.ai.openai.model
自spring.ai.openai.chat.options.model
. -
从
spring.ai.openai.temperature
自spring.ai.openai.chat.options.temperature
.
查找有关 OpenAi 属性的更新文档:docs.spring.io/spring-ai/reference/api/chat/openai-chat.html
2023 年 12 月 27 日更新
将 SimplePersistentVectorStore 和 InMemoryVectorStore 合并到 SimpleVectorStore 中 * 将 InMemoryVectorStore 替换为 SimpleVectorStore
2023 年 12 月 20 日更新
重构 Ollama 客户端和相关类和包名称
-
将org.springframework.ai.ollama.client.OllamaClient替换为org.springframework.ai.ollama.OllamaModelCall。
-
OllamaChatClient 方法签名已更改。
-
将org.springframework.ai.autoconfigure.ollama.OllamaProperties重命名为org.springframework.ai.autoconfigure.ollama.OllamaChatProperties,并将后缀更改为:
spring.ai.ollama.chat
.一些属性也发生了变化。
2023 年 12 月 19 日更新
重命名 AiClient 和相关类和包名
-
将 AiClient 重命名为 ChatClient
-
将 AiResponse 重命名为 ChatResponse
-
将 AiStreamClient 重命名为 StreamingChatClient
-
将包 org.sf.ai.client 重命名为 org.sf.ai.chat
重命名 的工件 ID
-
transformers-embedding
自spring-ai-transformers
将 Maven 模块从顶级目录和embedding-clients
子目录下的所有models
目录。
12月 1, 2023
我们正在转换项目的组 ID:
-
出发地:
org.springframework.experimental.ai
-
收件人:
org.springframework.ai
构件仍将托管在快照存储库中,如下所示。
main 分支将移动到版本0.8.0-SNAPSHOT
.
它会不稳定一两周。
如果您不想处于最前沿,请使用 0.7.1-SNAPSHOT。
您可以访问0.7.1-SNAPSHOT
工件,并且仍然可以访问 0.7.1-SNAPSHOT 文档。
0.7.1-SNAPSHOT 依赖项
-
Azure OpenAI
<dependency> <groupId>org.springframework.experimental.ai</groupId> <artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId> <version>0.7.1-SNAPSHOT</version> </dependency>
-
开放人工智能
<dependency> <groupId>org.springframework.experimental.ai</groupId> <artifactId>spring-ai-openai-spring-boot-starter</artifactId> <version>0.7.1-SNAPSHOT</version> </dependency>
升级到 1.0.0.M4
-
删除 PaLM API 支持
作为弃用 PaLM API 的公告的后续行动,已删除 PaLM API 支持。