You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-ai-docs/src/main/antora/modules/ROOT/pages/upgrade-notes.adoc
+17-14Lines changed: 17 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,13 @@ This approach can save time and reduce the chance of errors when upgrading multi
46
46
[[upgrading-to-1-0-0-m8]]
47
47
== Upgrading to 1.0.0-M8
48
48
49
+
You can automate the upgrade process to 1.0.0-M8 using an OpenRewrite recipe.
50
+
This recipe helps apply many of the necessary code changes for this version.
51
+
Find the recipe and usage instructions at https://github.com/arconia-io/arconia-migrations/blob/main/docs/spring-ai.md[Arconia Spring AI Migrations].
52
+
49
53
=== Chat Client
50
54
51
-
* The `ChatClient` has been enhanced to solve some inconsistencies or unwanted behaviour whenever user and system prompts were not rendered before using them in an advisor. The new behavior ensures that the user and system prompts are always rendered before executing the chain of advisors. As part of this enhancement, the `AdvisedRequest` and `AdvisedResponse` APIs have been deprecated, replaced by `ChatClientRequest` and `ChatClientResponse`. Advisors now act on a fully built `Prompt` object included in a `ChatClientRequest` instead of the destructured format used in `AdvisedRequest`, guaranteeing consistency and completeness.
55
+
* The `ChatClient` has been enhanced to solve some inconsistencies or unwanted behavior whenever user and system prompts were not rendered before using them in an advisor. The new behavior ensures that the user and system prompts are always rendered before executing the chain of advisors. As part of this enhancement, the `AdvisedRequest` and `AdvisedResponse` APIs have been deprecated, replaced by `ChatClientRequest` and `ChatClientResponse`. Advisors now act on a fully built `Prompt` object included in a `ChatClientRequest` instead of the destructured format used in `AdvisedRequest`, guaranteeing consistency and completeness.
52
56
53
57
For example, if you had a custom advisor that modified the request prompt in the `before` method, you would refactor it as follows:
54
58
@@ -133,7 +137,8 @@ This change addresses potential confusion where the Java compiler might not sele
133
137
134
138
=== Prompt Templating and Advisors
135
139
136
-
Several classes and methods related to prompt creation and advisor customization have been deprecated in favor of more flexible approaches using the builder pattern and the `TemplateRenderer` interface.
140
+
Several classes and methods related to prompt creation and advisor customization have been deprecated in favor of more flexible approaches using the builder pattern and the `TemplateRenderer` interface.
141
+
See xref:api/prompt.adoc#_prompttemplate[PromptTemplate] for details on the new API.
137
142
138
143
==== PromptTemplate Deprecations
139
144
@@ -614,7 +619,6 @@ new DefaultUsage(Long promptTokens, Long generationTokens, Long totalTokens)
614
619
new DefaultUsage(Integer promptTokens, Integer completionTokens, Integer totalTokens)
615
620
----
616
621
617
-
618
622
NOTE: For more information on handling Usage, refer xref:api/usage-handling.adoc[here]
619
623
620
624
==== JSON Ser/Deser changes
@@ -666,7 +670,7 @@ NOTE: Refer to xref:api/chat/bedrock-converse.adoc[Bedrock Converse] documentati
666
670
667
671
=== Changes to use Spring Boot 3.4.2 for dependency management
668
672
669
-
Spring AI updates to use Spring Boot 3.4.2 for the dependency management. You can refer https://github.com/spring-projects/spring-boot/blob/v3.4.2/spring-boot-project/spring-boot-dependencies/build.gradle[here] for the dependencies which Spring Boot 3.4.2
673
+
Spring AI updates to use Spring Boot 3.4.2 for the dependency management. You can refer https://github.com/spring-projects/spring-boot/blob/v3.4.2/spring-boot-project/spring-boot-dependencies/build.gradle[here] for the dependencies managed by Spring Boot 3.4.2
670
674
671
675
==== Required Actions
672
676
@@ -732,18 +736,18 @@ On our march to release 1.0.0 M1 we have made several breaking changes. Apologi
732
736
733
737
=== ChatClient changes
734
738
735
-
A major change was made that took the 'old' `ChatClient` and moved the functionality into `ChatModel`. The 'new' `ChatClient` now takes an instance of `ChatModel`. This was done do support a fluent API for creating and executing prompts in a style similar to other client classes in the Spring ecosystem, such as `RestClient`, `WebClient`, and `JdbcClient`. Refer to the [JavaDoc](https://docs.spring.io/spring-ai/docs/api) for more information on the Fluent API, proper reference documentation is coming shortly.
739
+
A major change was made that took the 'old' `ChatClient` and moved the functionality into `ChatModel`. The 'new' `ChatClient` now takes an instance of `ChatModel`. This was done to support a fluent API for creating and executing prompts in a style similar to other client classes in the Spring ecosystem, such as `RestClient`, `WebClient`, and `JdbcClient`. Refer to the [JavaDoc](https://docs.spring.io/spring-ai/docs/api) for more information on the Fluent API, proper reference documentation is coming shortly.
736
740
737
-
We renamed the 'old' `ModelClient` to `Model` and renamed implementing classes, for example `ImageClient` was renamed to `ImageModel`. The `Model` implementation represent the portability layer that converts between the Spring AI API and the underlying AI Model API.
741
+
We renamed the 'old' `ModelClient` to `Model` and renamed implementing classes, for example `ImageClient` was renamed to `ImageModel`. The `Model` implementation represents the portability layer that converts between the Spring AI API and the underlying AI Model API.
738
742
739
743
### Adapting to the changes
740
744
741
745
NOTE: The `ChatClient` class is now in the package `org.springframework.ai.chat.client`
742
746
743
747
#### Approach 1
744
748
745
-
Now, instead of getting an Autoconfigured `ChatClient` instance, you will get a `ChatModel` instance. The `call` method signatures after renaming remain the same.
746
-
To adapt your code should refactor you code to change use of the type `ChatClient` to `ChatModel`
749
+
Now, instead of getting an Autoconfigured `ChatClient` instance, you will get a `ChatModel` instance. The `call` method signatures after renaming remain the same.
750
+
To adapt your code should refactor your code to change the use of the type `ChatClient` to `ChatModel`
747
751
Here is an example of existing code before the change
748
752
749
753
```java
@@ -837,12 +841,11 @@ class SimpleAiController {
837
841
}
838
842
```
839
843
840
-
841
844
NOTE: The `ChatModel` instance is made available to you through autoconfiguration.
842
845
843
846
#### Approach 3
844
847
845
-
There is a tag in the GitHub repository called [v1.0.0-SNAPSHOT-before-chatclient-changes](https://github.com/spring-projects/spring-ai/tree/v1.0.0-SNAPSHOT-before-chatclient-changes) that you can checkout and do a local build to avoid updating any of your code until you are ready to migrate your code base.
848
+
There is a tag in the GitHub repository called [v1.0.0-SNAPSHOT-before-chatclient-changes](https://github.com/spring-projects/spring-ai/tree/v1.0.0-SNAPSHOT-before-chatclient-changes) that you can check out and do a local build to avoid updating any of your code until you are ready to migrate your code base.
* Moving the `prompt` and `messages` and `metadata` packages to subpackages of `org.sf.ai.chat`
924
+
* Moving the `prompt` and `messages` and `metadata` packages to subpackages of `org.springframework.ai.chat`
922
925
* New functionality is *text to image* clients. Classes are `OpenAiImageModel` and `StabilityAiImageModel`. See the integration tests for usage, docs are coming soon.
923
-
* 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.
924
-
* A new "portable options" design pattern. We wanted to provide as much portability in the `ModelCall` 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 `ImageModel` 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 `ImageModel` API. These option data types are using in autoconfiguration/configuration properties for the `ImageModel` implementations.
926
+
* 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.
927
+
* A new "portable options" design pattern. We wanted to provide as much portability in the `ModelCall` 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 `ImageModel` 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 `ImageModel` API. These option data types are used in autoconfiguration/configuration properties for the `ImageModel` implementations.
925
928
926
929
=== January 13, 2024 Update
927
930
928
-
The following OpenAi Autoconfiguration chat properties has changed
931
+
The following OpenAi Autoconfiguration chat properties have changed
929
932
930
933
* from `spring.ai.openai.model` to `spring.ai.openai.chat.options.model`.
931
934
* from `spring.ai.openai.temperature` to `spring.ai.openai.chat.options.temperature`.
0 commit comments