Add support for use of AZURE_OPENAI_DEPLOYMENT_NAME in IT tests
* remove from README.md info of changed default for initialize-schema
This commit is contained in:
21
README.md
21
README.md
@@ -12,27 +12,6 @@ For further information go to our [Spring AI reference documentation](https://do
|
||||
|
||||
On our march to release 1.0.0 M1 we have made several breaking changes. Apologies, it is for the best!
|
||||
|
||||
**(22.25.2024)**
|
||||
|
||||
Vector stores that have a schema are now *not* initialized by default.
|
||||
As is the convention with other Spring projects that rely on a schema, you must opt into allowing Spring to create a schema for you.
|
||||
A new configuration property named `initialize-schema` has been introduced, with `false` being the default value.
|
||||
Check the documentation section for your vector store's configuration properties for the full syntax.
|
||||
The following vector stores have been impacted by this change
|
||||
|
||||
* Azure AI Search
|
||||
* Chroma
|
||||
* Elasticsearch
|
||||
* SAP Hana
|
||||
* Milvus
|
||||
* MongoDB
|
||||
* Neo4j
|
||||
* PGVector
|
||||
* Pinecone
|
||||
* Qdrant
|
||||
* Redis
|
||||
* Weaviate
|
||||
|
||||
**(22.05.2024)**
|
||||
|
||||
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/1.0.0-SNAPSHOT/api/) for more information on the Fluent API, proper reference documentation is coming shortly.
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.springframework.ai.autoconfigure.azure.tool;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class DeploymentNameUtil {
|
||||
|
||||
public static String getDeploymentName() {
|
||||
String deploymentName = System.getenv("AZURE_OPENAI_DEPLOYMENT_NAME");
|
||||
if (StringUtils.hasText(deploymentName)) {
|
||||
return deploymentName;
|
||||
}
|
||||
else {
|
||||
return "gpt-4-0125-preview";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,8 +35,10 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Description;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.ai.autoconfigure.azure.tool.DeploymentNameUtil.getDeploymentName;
|
||||
|
||||
@EnabledIfEnvironmentVariable(named = "AZURE_OPENAI_API_KEY", matches = ".+")
|
||||
@EnabledIfEnvironmentVariable(named = "AZURE_OPENAI_ENDPOINT", matches = ".+")
|
||||
@@ -54,7 +56,7 @@ class FunctionCallWithFunctionBeanIT {
|
||||
|
||||
@Test
|
||||
void functionCallTest() {
|
||||
contextRunner.withPropertyValues("spring.ai.azure.openai.chat.options..deployment-name=gpt-4-0125-preview")
|
||||
contextRunner.withPropertyValues("spring.ai.azure.openai.chat.options..deployment-name=" + getDeploymentName())
|
||||
.run(context -> {
|
||||
|
||||
ChatModel chatModel = context.getBean(AzureOpenAiChatModel.class);
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.ai.autoconfigure.azure.tool.DeploymentNameUtil.getDeploymentName;
|
||||
|
||||
@EnabledIfEnvironmentVariable(named = "AZURE_OPENAI_API_KEY", matches = ".+")
|
||||
@EnabledIfEnvironmentVariable(named = "AZURE_OPENAI_ENDPOINT", matches = ".+")
|
||||
@@ -53,7 +54,7 @@ public class FunctionCallWithFunctionWrapperIT {
|
||||
|
||||
@Test
|
||||
void functionCallTest() {
|
||||
contextRunner.withPropertyValues("spring.ai.azure.openai.chat.options.deployment-name=gpt-4-0125-preview")
|
||||
contextRunner.withPropertyValues("spring.ai.azure.openai.chat.options.deployment-name=" + getDeploymentName())
|
||||
.run(context -> {
|
||||
|
||||
AzureOpenAiChatModel chatModel = context.getBean(AzureOpenAiChatModel.class);
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.ai.autoconfigure.azure.tool.DeploymentNameUtil.getDeploymentName;
|
||||
|
||||
@EnabledIfEnvironmentVariable(named = "AZURE_OPENAI_API_KEY", matches = ".+")
|
||||
@EnabledIfEnvironmentVariable(named = "AZURE_OPENAI_ENDPOINT", matches = ".+")
|
||||
@@ -49,7 +50,7 @@ public class FunctionCallWithPromptFunctionIT {
|
||||
|
||||
@Test
|
||||
void functionCallTest() {
|
||||
contextRunner.withPropertyValues("spring.ai.azure.openai.chat.options.deployment-name=gpt-4-0125-preview")
|
||||
contextRunner.withPropertyValues("spring.ai.azure.openai.chat.options.deployment-name=" + getDeploymentName())
|
||||
.run(context -> {
|
||||
|
||||
AzureOpenAiChatModel chatModel = context.getBean(AzureOpenAiChatModel.class);
|
||||
|
||||
Reference in New Issue
Block a user