升级 Notes

升级到 1.0.0.RC1

  • 便携式聊天选项的类型 (frequencyPenalty,presencePenalty,temperature,topP) 已从FloatDouble.spring-doc.cadn.net.cn

升级到 1.0.0.M2

  • Chroma Vector Store 的配置前缀已从spring.ai.vectorstore.chroma.storespring.ai.vectorstore.chroma为了与其他 Vector Store 的命名约定保持一致。spring-doc.cadn.net.cn

  • initialize-schema能够初始化 Schema 的 vector store 上的属性现在设置为false. 这意味着,如果需要在应用程序启动时创建架构,则应用程序现在需要在支持的向量存储上显式选择加入架构初始化。 并非所有 vector store 都支持此属性。 有关更多详细信息,请参阅相应的 vector store 文档。 以下是目前不支持initialize-schema财产。spring-doc.cadn.net.cn

  • 在 Bedrock Jurassic 2 中,聊天选项countPenalty,frequencyPenaltypresencePenalty已重命名为countPenaltyOptions,frequencyPenaltyOptionspresencePenaltyOptions. 此外,聊天选项的类型stopSequences已从String[]List<String>.spring-doc.cadn.net.cn

  • 在 Azure OpenAI 中,聊天选项的类型frequencyPenaltypresencePenalty已从DoubleFloat,与所有其他实现一致。spring-doc.cadn.net.cn

升级到 1.0.0.M1

在发布 1.0.0 M1 的过程中,我们进行了几项重大更改。抱歉,这是最好的!spring-doc.cadn.net.cn

ChatClient 更改

进行了一次重大更改,将“旧的”ChatClient并将功能移至ChatModel.“新”ChatClient现在采用ChatModel.这样做是为了支持一个 Fluent API,用于以类似于 Spring 生态系统中其他客户端类的样式创建和执行提示,例如RestClient,WebClientJdbcClient.有关 Fluent API 的更多信息,请参阅 [JavaDoc](docs.spring.io/spring-ai/docs/api),适当的参考文档即将发布。spring-doc.cadn.net.cn

我们将 'old' 重命名为ModelClientModel并重命名了实现类,例如ImageClient已重命名为ImageModel.这Modelimplementation 表示在 Spring AI API 和底层 AI 模型 API 之间进行转换的可移植性层。spring-doc.cadn.net.cn

适应变化

ChatClientclass 现在位于软件包中org.springframework.ai.chat.client

方法 1

现在,无需获取 AutoconfiguredChatClient实例,您将获得一个ChatModel实例。这call重命名后的方法签名保持不变。 要适应您的代码,您应该重构您的代码以更改ChatClientChatModel以下是更改前的现有代码示例spring-doc.cadn.net.cn

@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));
    }
}

现在,在更改之后,这将是spring-doc.cadn.net.cn

@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));
    }
}
重命名也适用于类 *StreamingChatClientStreamingChatModel * EmbeddingClientEmbeddingModel * ImageClientImageModel * SpeechClientSpeechModel* 和其他类似<XYZ>Client

方法 2

在此方法中,您将使用“new”上提供的新 Fluent APIChatClientspring-doc.cadn.net.cn

以下是更改前的现有代码示例spring-doc.cadn.net.cn

@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)
        );
	}
}

现在,在更改之后,这将是spring-doc.cadn.net.cn

@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) 的标记,您可以签出该标记并执行本地构建,以避免在准备好迁移代码库之前更新任何代码。spring-doc.cadn.net.cn

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-starterspring-doc.cadn.net.cn

升级到 0.8.1

spring-ai-vertex-ai已重命名为spring-ai-vertex-ai-palm2spring-ai-vertex-ai-spring-boot-starter已重命名为spring-ai-vertex-ai-palm2-spring-boot-starter.spring-doc.cadn.net.cn

因此,您需要将依赖项从spring-doc.cadn.net.cn

<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 已从spring-doc.cadn.net.cn

<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>

升级到 0.8.0

2024 年 1 月 24 日更新

  • promptmessagesmetadatapackages 的子软件包org.sf.ai.chatspring-doc.cadn.net.cn

  • 新功能是文本到图像客户端。类是OpenAiImageModelStabilityAiImageModel.有关用法,请参阅集成测试,文档即将推出。spring-doc.cadn.net.cn

  • 新软件包model其中包含接口和基类,以支持为任何输入/输出数据类型组合创建 AI 模型客户端。目前,chat 和 image model 包实现了这一点。我们很快就会将 embedding 包更新到这个新模型。spring-doc.cadn.net.cn

  • 新的 “portable options” 设计模式。我们希望在ModelCall尽可能跨不同的基于聊天的 AI 模型。有一组通用的生成选项,然后是特定于模型提供程序的选项。使用了一种 “duck typing” 方法。ModelOptions在 model 包中是一个 marker 接口,指示此类的实现将为模型提供选项。看ImageOptions,一个定义所有 text→image 的可移植选项的子接口ImageModel实现。然后StabilityAiImageOptionsOpenAiImageOptions提供特定于每个模型提供程序的选项。所有选项类都是通过 Fluent API 构建器创建的,都可以传递到可移植的ImageModel应用程序接口。这些选项数据类型在 autoconfiguration/configuration 属性中使用ImageModel实现。spring-doc.cadn.net.cn

2024 年 1 月 13 日更新

以下 OpenAi 自动配置聊天属性已更改spring-doc.cadn.net.cn

2023 年 12 月 27 日更新

将 SimplePersistentVectorStore 和 InMemoryVectorStore 合并到 SimpleVectorStore 中 * 将 InMemoryVectorStore 替换为 SimpleVectorStorespring-doc.cadn.net.cn

2023 年 12 月 20 日更新

重构 Ollama 客户端和相关类和包名称spring-doc.cadn.net.cn

  • 将org.springframework.ai.ollama.client.OllamaClient替换为org.springframework.ai.ollama.OllamaModelCall。spring-doc.cadn.net.cn

  • OllamaChatClient 方法签名已更改。spring-doc.cadn.net.cn

  • 将org.springframework.ai.autoconfigure.ollama.OllamaProperties重命名为org.springframework.ai.autoconfigure.ollama.OllamaChatProperties,并将后缀更改为:spring.ai.ollama.chat.一些属性也发生了变化。spring-doc.cadn.net.cn

2023 年 12 月 19 日更新

重命名 AiClient 和相关类和包名spring-doc.cadn.net.cn

重命名 的工件 IDspring-doc.cadn.net.cn

将 Maven 模块从顶级目录和embedding-clients子目录下的所有models目录。spring-doc.cadn.net.cn

12月 1, 2023

我们正在转换项目的组 ID:spring-doc.cadn.net.cn

构件仍将托管在快照存储库中,如下所示。spring-doc.cadn.net.cn

main 分支将移动到版本0.8.0-SNAPSHOT. 它会不稳定一两周。 如果您不想处于最前沿,请使用 0.7.1-SNAPSHOT。spring-doc.cadn.net.cn

您可以访问0.7.1-SNAPSHOT工件,并且仍然可以访问 0.7.1-SNAPSHOT 文档spring-doc.cadn.net.cn

0.7.1-SNAPSHOT 依赖项

  • Azure OpenAIspring-doc.cadn.net.cn

    <dependency>
        <groupId>org.springframework.experimental.ai</groupId>
        <artifactId>spring-ai-azure-openai-spring-boot-starter</artifactId>
        <version>0.7.1-SNAPSHOT</version>
    </dependency>
  • 开放人工智能spring-doc.cadn.net.cn

    <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 支持。spring-doc.cadn.net.cn