From 3fbf707037689cda90f67dc02ca54983cfd1a5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=2E=EA=A7=94?= <93132738+qing-wq@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:43:28 +0800 Subject: [PATCH 01/25] fix #1827 ComponentScan with SPEL will not parse (#48) Fixes https://github.com/langchain4j/langchain4j/issues/1827 fix ComponentScan basePackages with placeholders will not be parsed. Changes Made: - Support for parsing @ComponentScan with placeholders - Simplify the getBasePackages() --- .../spring/AiServiceScannerProcessor.java | 60 +++++++++---------- .../package1/DifferentPackageAiServiceIT.java | 29 +++++++++ 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServiceScannerProcessor.java b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServiceScannerProcessor.java index cdcad4ca..02e16ae0 100644 --- a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServiceScannerProcessor.java +++ b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServiceScannerProcessor.java @@ -6,14 +6,15 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import org.springframework.boot.autoconfigure.AutoConfigurationPackages; -import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.EnvironmentAware; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Profile; -import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.util.ClassUtils; +import org.springframework.util.StringUtils; import java.util.*; @@ -24,11 +25,9 @@ public class AiServiceScannerProcessor implements BeanDefinitionRegistryPostProc @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { - ClassPathAiServiceScanner classPathAiServiceScanner = new ClassPathAiServiceScanner(registry, false); + ClassPathAiServiceScanner scanner = new ClassPathAiServiceScanner(registry, false); Set basePackages = getBasePackages((ConfigurableListableBeanFactory) registry); - for (String basePackage : basePackages) { - classPathAiServiceScanner.scan(basePackage); - } + scanner.scan(StringUtils.toStringArray(basePackages)); removeAiServicesWithInactiveProfiles(registry); } @@ -36,37 +35,36 @@ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) t private Set getBasePackages(ConfigurableListableBeanFactory beanFactory) { Set basePackages = new LinkedHashSet<>(); + // AutoConfiguration List autoConfigPackages = AutoConfigurationPackages.get(beanFactory); basePackages.addAll(autoConfigPackages); - String[] beanNames = beanFactory.getBeanNamesForAnnotation(ComponentScan.class); - for (String beanName : beanNames) { - Class beanClass = beanFactory.getType(beanName); - if (beanClass != null) { - ComponentScan componentScan = beanClass.getAnnotation(ComponentScan.class); - if (componentScan != null) { - Collections.addAll(basePackages, componentScan.value()); - Collections.addAll(basePackages, componentScan.basePackages()); - for (Class basePackageClass : componentScan.basePackageClasses()) { - basePackages.add(basePackageClass.getPackage().getName()); - } - } - } - } + // ComponentScan + addComponentScanPackages(beanFactory, basePackages); + + return basePackages; + } - String[] applicationBeans = beanFactory.getBeanNamesForAnnotation(SpringBootApplication.class); - if (applicationBeans.length > 0) { - Class applicationBeanClass = beanFactory.getType(applicationBeans[0]); - SpringBootApplication springBootApplication = AnnotationUtils.findAnnotation(applicationBeanClass, SpringBootApplication.class); - if (springBootApplication != null) { - Collections.addAll(basePackages, springBootApplication.scanBasePackages()); - for (Class aClass : springBootApplication.scanBasePackageClasses()) { - basePackages.add(ClassUtils.getPackageName(aClass)); + private void addComponentScanPackages(ConfigurableListableBeanFactory beanFactory, Set collectedBasePackages) { + beanFactory.getBeansWithAnnotation(ComponentScan.class).forEach((beanName, instance) -> { + Set componentScans = AnnotatedElementUtils.getMergedRepeatableAnnotations(instance.getClass(), ComponentScan.class); + for (ComponentScan componentScan : componentScans) { + Set basePackages = new LinkedHashSet<>(); + String[] basePackagesArray = componentScan.basePackages(); + for (String pkg : basePackagesArray) { + String[] tokenized = StringUtils.tokenizeToStringArray(this.environment.resolvePlaceholders(pkg), + ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS); + Collections.addAll(basePackages, tokenized); + } + for (Class clazz : componentScan.basePackageClasses()) { + basePackages.add(ClassUtils.getPackageName(clazz)); + } + if (basePackages.isEmpty()) { + basePackages.add(ClassUtils.getPackageName(instance.getClass())); } + collectedBasePackages.addAll(basePackages); } - } - - return basePackages; + }); } private void removeAiServicesWithInactiveProfiles(BeanDefinitionRegistry registry) { diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/differentPackage/package1/DifferentPackageAiServiceIT.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/differentPackage/package1/DifferentPackageAiServiceIT.java index f02a2168..6727d383 100644 --- a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/differentPackage/package1/DifferentPackageAiServiceIT.java +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/differentPackage/package1/DifferentPackageAiServiceIT.java @@ -27,6 +27,10 @@ static class ComponentScanWithBasePackages { static class ComponentScanWithBasePackageClasses { } + @ComponentScan(basePackages = "${test.basePackages}") + static class ComponentScanWithPlaceholder { + } + @Test void should_create_AI_service_that_use_componentScan_value() { @@ -98,4 +102,29 @@ void should_create_AI_service_that_use_componentScan_basePackageClasses() { assertThat(answer).containsIgnoringCase("Berlin"); }); } + + @Test + void should_create_AI_service_that_use_componentScan_with_placeholder() { + + contextRunner + .withPropertyValues( + "langchain4j.open-ai.chat-model.api-key=" + OPENAI_API_KEY, + "langchain4j.open-ai.chat-model.max-tokens=20", + "langchain4j.open-ai.chat-model.temperature=0.0", + "test.basePackages=dev.langchain4j.service.spring.mode.automatic.differentPackage.package2" + ) + .withUserConfiguration(DifferentPackageAiServiceApplication.class) + .withUserConfiguration(ComponentScanWithPlaceholder.class) + .run(context -> { + + // given + DifferentPackageAiService aiService = context.getBean(DifferentPackageAiService.class); + + // when + String answer = aiService.chat("What is the capital of Germany?"); + + // then + assertThat(answer).containsIgnoringCase("Berlin"); + }); + } } \ No newline at end of file From f06f8334396c12f8cdd99c2aa3c7123580361671 Mon Sep 17 00:00:00 2001 From: Antoine Rey Date: Thu, 7 Nov 2024 15:14:07 +0100 Subject: [PATCH 02/25] fix #2038 Add custom-headers to the Azure Open AI Spring Boot Starter (#50) Fix issue https://github.com/langchain4j/langchain4j/issues/2038 Is there any markdown documentation file to complete? Do I need to create an integration test? If so, how? --- .../java/dev/langchain4j/azure/openai/spring/AutoConfig.java | 4 ++++ .../langchain4j/azure/openai/spring/ChatModelProperties.java | 2 ++ .../azure/openai/spring/EmbeddingModelProperties.java | 3 +++ .../langchain4j/azure/openai/spring/ImageModelProperties.java | 3 +++ 4 files changed, 12 insertions(+) diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java index 9a056498..74281776 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java @@ -47,6 +47,7 @@ AzureOpenAiChatModel openAiChatModel(Properties properties) { .timeout(Duration.ofSeconds(chatModelProperties.getTimeout() == null ? 0 : chatModelProperties.getTimeout())) .maxRetries(chatModelProperties.getMaxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) + .customHeaders(chatModelProperties.getCustomHeaders()) .logRequestsAndResponses(chatModelProperties.getLogRequestsAndResponses() != null && chatModelProperties.getLogRequestsAndResponses()); if (chatModelProperties.getNonAzureApiKey() != null) { builder.nonAzureApiKey(chatModelProperties.getNonAzureApiKey()); @@ -81,6 +82,7 @@ AzureOpenAiStreamingChatModel openAiStreamingChatModel(Properties properties) { .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) .timeout(Duration.ofSeconds(chatModelProperties.getTimeout() == null ? 0 : chatModelProperties.getTimeout())) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) + .customHeaders(chatModelProperties.getCustomHeaders()) .logRequestsAndResponses(chatModelProperties.getLogRequestsAndResponses() != null && chatModelProperties.getLogRequestsAndResponses()); if (chatModelProperties.getNonAzureApiKey() != null) { builder.nonAzureApiKey(chatModelProperties.getNonAzureApiKey()); @@ -110,6 +112,7 @@ AzureOpenAiEmbeddingModel openAiEmbeddingModel(Properties properties, Tokenizer .tokenizer(tokenizer) .timeout(Duration.ofSeconds(embeddingModelProperties.getTimeout() == null ? 0 : embeddingModelProperties.getTimeout())) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) + .customHeaders(embeddingModelProperties.getCustomHeaders()) .logRequestsAndResponses(embeddingModelProperties.getLogRequestsAndResponses() != null && embeddingModelProperties.getLogRequestsAndResponses()); if (embeddingModelProperties.getNonAzureApiKey() != null) { @@ -144,6 +147,7 @@ AzureOpenAiImageModel openAiImageModel(Properties properties) { .timeout(imageModelProperties.getTimeout() == null ? null : Duration.ofSeconds(imageModelProperties.getTimeout())) .maxRetries(imageModelProperties.getMaxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) + .customHeaders(imageModelProperties.getCustomHeaders()) .logRequestsAndResponses(imageModelProperties.getLogRequestsAndResponses() != null && imageModelProperties.getLogRequestsAndResponses()); if (imageModelProperties.getNonAzureApiKey() != null) { builder.nonAzureApiKey(imageModelProperties.getNonAzureApiKey()); diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java index 2058afd4..5b27eb5c 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java @@ -4,6 +4,7 @@ import lombok.Setter; import java.util.List; +import java.util.Map; @Getter @Setter @@ -25,4 +26,5 @@ class ChatModelProperties { Integer timeout; Integer maxRetries; Boolean logRequestsAndResponses; + Map customHeaders; } \ No newline at end of file diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java index c65cccc4..e4140a31 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java @@ -3,6 +3,8 @@ import lombok.Getter; import lombok.Setter; +import java.util.Map; + @Getter @Setter class EmbeddingModelProperties { @@ -15,4 +17,5 @@ class EmbeddingModelProperties { Integer timeout; Integer maxRetries; Boolean logRequestsAndResponses; + Map customHeaders; } \ No newline at end of file diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java index 215cd64d..75d2bd28 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java @@ -3,6 +3,8 @@ import lombok.Getter; import lombok.Setter; +import java.util.Map; + @Getter @Setter class ImageModelProperties { @@ -19,4 +21,5 @@ class ImageModelProperties { Integer timeout; Integer maxRetries; Boolean logRequestsAndResponses; + Map customHeaders; } \ No newline at end of file From 36ac08525f3b01f0e0f408f93f90ad4a97c801c3 Mon Sep 17 00:00:00 2001 From: Antoine Rey Date: Thu, 7 Nov 2024 15:27:15 +0100 Subject: [PATCH 03/25] Get rid of lombok for langchain4j-spring-boot-starter and langchain4j-open-ai-spring-boot-starter (#49) ## Issue Langchain4j project issue: https://github.com/langchain4j/langchain4j/issues/1636 ## Change Get rid of lombok from 2 modules: `langchain4j-spring-boot-starter` and `langchain4j-open-ai-spring-boot-starter`. I'll use java `record` for class annotated with `@ConfigurationProperties`. I don't have any credentials/API keys to refactor then test others modules. ## General checklist - [X] There are no breaking changes - [ ] I have added unit and integration tests for my change - [X] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green - [ ] I have manually run all the unit and integration tests in the [core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core) and [main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j) modules, and they are all green - [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) - [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features) - [ ] I have added/updated [Spring Boot starter(s)](https://github.com/langchain4j/langchain4j-spring) (if applicable) --- .../pom.xml | 7 - .../langchain4j/openai/spring/AutoConfig.java | 226 +++++++++--------- .../openai/spring/ChatModelProperties.java | 55 ++--- .../spring/EmbeddingModelProperties.java | 33 ++- .../openai/spring/ImageModelProperties.java | 42 ++-- .../spring/LanguageModelProperties.java | 30 ++- .../spring/ModerationModelProperties.java | 27 +-- .../langchain4j/openai/spring/Properties.java | 25 +- .../openai/spring/ProxyProperties.java | 13 +- langchain4j-spring-boot-starter/pom.xml | 7 - .../langchain4j/rag/spring/RagAutoConfig.java | 6 +- .../langchain4j/rag/spring/RagProperties.java | 10 +- .../rag/spring/RetrievalProperties.java | 10 +- 13 files changed, 223 insertions(+), 268 deletions(-) diff --git a/langchain4j-open-ai-spring-boot-starter/pom.xml b/langchain4j-open-ai-spring-boot-starter/pom.xml index 86f740c6..a680136c 100644 --- a/langchain4j-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-open-ai-spring-boot-starter/pom.xml @@ -33,13 +33,6 @@ true - - - org.projectlombok - lombok - provided - - org.springframework.boot diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/AutoConfig.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/AutoConfig.java index d3527a17..d0db55ac 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/AutoConfig.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/AutoConfig.java @@ -16,162 +16,162 @@ public class AutoConfig { @Bean @ConditionalOnProperty(PREFIX + ".chat-model.api-key") OpenAiChatModel openAiChatModel(Properties properties) { - ChatModelProperties chatModelProperties = properties.getChatModel(); + ChatModelProperties chatModelProperties = properties.chatModel(); return OpenAiChatModel.builder() - .baseUrl(chatModelProperties.getBaseUrl()) - .apiKey(chatModelProperties.getApiKey()) - .organizationId(chatModelProperties.getOrganizationId()) - .modelName(chatModelProperties.getModelName()) - .temperature(chatModelProperties.getTemperature()) - .topP(chatModelProperties.getTopP()) - .stop(chatModelProperties.getStop()) - .maxTokens(chatModelProperties.getMaxTokens()) - .maxCompletionTokens(chatModelProperties.getMaxCompletionTokens()) - .presencePenalty(chatModelProperties.getPresencePenalty()) - .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) - .logitBias(chatModelProperties.getLogitBias()) - .responseFormat(chatModelProperties.getResponseFormat()) - .strictJsonSchema(chatModelProperties.getStrictJsonSchema()) - .seed(chatModelProperties.getSeed()) - .user(chatModelProperties.getUser()) - .strictTools(chatModelProperties.getStrictTools()) - .parallelToolCalls(chatModelProperties.getParallelToolCalls()) - .timeout(chatModelProperties.getTimeout()) - .maxRetries(chatModelProperties.getMaxRetries()) - .proxy(ProxyProperties.convert(chatModelProperties.getProxy())) - .logRequests(chatModelProperties.getLogRequests()) - .logResponses(chatModelProperties.getLogResponses()) - .customHeaders(chatModelProperties.getCustomHeaders()) + .baseUrl(chatModelProperties.baseUrl()) + .apiKey(chatModelProperties.apiKey()) + .organizationId(chatModelProperties.organizationId()) + .modelName(chatModelProperties.modelName()) + .temperature(chatModelProperties.temperature()) + .topP(chatModelProperties.topP()) + .stop(chatModelProperties.stop()) + .maxTokens(chatModelProperties.maxTokens()) + .maxCompletionTokens(chatModelProperties.maxCompletionTokens()) + .presencePenalty(chatModelProperties.presencePenalty()) + .frequencyPenalty(chatModelProperties.frequencyPenalty()) + .logitBias(chatModelProperties.logitBias()) + .responseFormat(chatModelProperties.responseFormat()) + .strictJsonSchema(chatModelProperties.strictJsonSchema()) + .seed(chatModelProperties.seed()) + .user(chatModelProperties.user()) + .strictTools(chatModelProperties.strictTools()) + .parallelToolCalls(chatModelProperties.parallelToolCalls()) + .timeout(chatModelProperties.timeout()) + .maxRetries(chatModelProperties.maxRetries()) + .proxy(ProxyProperties.convert(chatModelProperties.proxy())) + .logRequests(chatModelProperties.logRequests()) + .logResponses(chatModelProperties.logResponses()) + .customHeaders(chatModelProperties.customHeaders()) .build(); } @Bean @ConditionalOnProperty(PREFIX + ".streaming-chat-model.api-key") OpenAiStreamingChatModel openAiStreamingChatModel(Properties properties) { - ChatModelProperties chatModelProperties = properties.getStreamingChatModel(); + ChatModelProperties chatModelProperties = properties.streamingChatModel(); return OpenAiStreamingChatModel.builder() - .baseUrl(chatModelProperties.getBaseUrl()) - .apiKey(chatModelProperties.getApiKey()) - .organizationId(chatModelProperties.getOrganizationId()) - .modelName(chatModelProperties.getModelName()) - .temperature(chatModelProperties.getTemperature()) - .topP(chatModelProperties.getTopP()) - .stop(chatModelProperties.getStop()) - .maxTokens(chatModelProperties.getMaxTokens()) - .maxCompletionTokens(chatModelProperties.getMaxCompletionTokens()) - .presencePenalty(chatModelProperties.getPresencePenalty()) - .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) - .logitBias(chatModelProperties.getLogitBias()) - .responseFormat(chatModelProperties.getResponseFormat()) - .seed(chatModelProperties.getSeed()) - .user(chatModelProperties.getUser()) - .strictTools(chatModelProperties.getStrictTools()) - .parallelToolCalls(chatModelProperties.getParallelToolCalls()) - .timeout(chatModelProperties.getTimeout()) - .proxy(ProxyProperties.convert(chatModelProperties.getProxy())) - .logRequests(chatModelProperties.getLogRequests()) - .logResponses(chatModelProperties.getLogResponses()) - .customHeaders(chatModelProperties.getCustomHeaders()) + .baseUrl(chatModelProperties.baseUrl()) + .apiKey(chatModelProperties.apiKey()) + .organizationId(chatModelProperties.organizationId()) + .modelName(chatModelProperties.modelName()) + .temperature(chatModelProperties.temperature()) + .topP(chatModelProperties.topP()) + .stop(chatModelProperties.stop()) + .maxTokens(chatModelProperties.maxTokens()) + .maxCompletionTokens(chatModelProperties.maxCompletionTokens()) + .presencePenalty(chatModelProperties.presencePenalty()) + .frequencyPenalty(chatModelProperties.frequencyPenalty()) + .logitBias(chatModelProperties.logitBias()) + .responseFormat(chatModelProperties.responseFormat()) + .seed(chatModelProperties.seed()) + .user(chatModelProperties.user()) + .strictTools(chatModelProperties.strictTools()) + .parallelToolCalls(chatModelProperties.parallelToolCalls()) + .timeout(chatModelProperties.timeout()) + .proxy(ProxyProperties.convert(chatModelProperties.proxy())) + .logRequests(chatModelProperties.logRequests()) + .logResponses(chatModelProperties.logResponses()) + .customHeaders(chatModelProperties.customHeaders()) .build(); } @Bean @ConditionalOnProperty(PREFIX + ".language-model.api-key") OpenAiLanguageModel openAiLanguageModel(Properties properties) { - LanguageModelProperties languageModelProperties = properties.getLanguageModel(); + LanguageModelProperties languageModelProperties = properties.languageModel(); return OpenAiLanguageModel.builder() - .baseUrl(languageModelProperties.getBaseUrl()) - .apiKey(languageModelProperties.getApiKey()) - .organizationId(languageModelProperties.getOrganizationId()) - .modelName(languageModelProperties.getModelName()) - .temperature(languageModelProperties.getTemperature()) - .timeout(languageModelProperties.getTimeout()) - .maxRetries(languageModelProperties.getMaxRetries()) - .proxy(ProxyProperties.convert(languageModelProperties.getProxy())) - .logRequests(languageModelProperties.getLogRequests()) - .logResponses(languageModelProperties.getLogResponses()) - .customHeaders(languageModelProperties.getCustomHeaders()) + .baseUrl(languageModelProperties.baseUrl()) + .apiKey(languageModelProperties.apiKey()) + .organizationId(languageModelProperties.organizationId()) + .modelName(languageModelProperties.modelName()) + .temperature(languageModelProperties.temperature()) + .timeout(languageModelProperties.timeout()) + .maxRetries(languageModelProperties.maxRetries()) + .proxy(ProxyProperties.convert(languageModelProperties.proxy())) + .logRequests(languageModelProperties.logRequests()) + .logResponses(languageModelProperties.logResponses()) + .customHeaders(languageModelProperties.customHeaders()) .build(); } @Bean @ConditionalOnProperty(PREFIX + ".streaming-language-model.api-key") OpenAiStreamingLanguageModel openAiStreamingLanguageModel(Properties properties) { - LanguageModelProperties languageModelProperties = properties.getStreamingLanguageModel(); + LanguageModelProperties languageModelProperties = properties.streamingLanguageModel(); return OpenAiStreamingLanguageModel.builder() - .baseUrl(languageModelProperties.getBaseUrl()) - .apiKey(languageModelProperties.getApiKey()) - .organizationId(languageModelProperties.getOrganizationId()) - .modelName(languageModelProperties.getModelName()) - .temperature(languageModelProperties.getTemperature()) - .timeout(languageModelProperties.getTimeout()) - .proxy(ProxyProperties.convert(languageModelProperties.getProxy())) - .logRequests(languageModelProperties.getLogRequests()) - .logResponses(languageModelProperties.getLogResponses()) - .customHeaders(languageModelProperties.getCustomHeaders()) + .baseUrl(languageModelProperties.baseUrl()) + .apiKey(languageModelProperties.apiKey()) + .organizationId(languageModelProperties.organizationId()) + .modelName(languageModelProperties.modelName()) + .temperature(languageModelProperties.temperature()) + .timeout(languageModelProperties.timeout()) + .proxy(ProxyProperties.convert(languageModelProperties.proxy())) + .logRequests(languageModelProperties.logRequests()) + .logResponses(languageModelProperties.logResponses()) + .customHeaders(languageModelProperties.customHeaders()) .build(); } @Bean @ConditionalOnProperty(PREFIX + ".embedding-model.api-key") OpenAiEmbeddingModel openAiEmbeddingModel(Properties properties) { - EmbeddingModelProperties embeddingModelProperties = properties.getEmbeddingModel(); + EmbeddingModelProperties embeddingModelProperties = properties.embeddingModel(); return OpenAiEmbeddingModel.builder() - .baseUrl(embeddingModelProperties.getBaseUrl()) - .apiKey(embeddingModelProperties.getApiKey()) - .organizationId(embeddingModelProperties.getOrganizationId()) - .modelName(embeddingModelProperties.getModelName()) - .dimensions(embeddingModelProperties.getDimensions()) - .user(embeddingModelProperties.getUser()) - .timeout(embeddingModelProperties.getTimeout()) - .maxRetries(embeddingModelProperties.getMaxRetries()) - .proxy(ProxyProperties.convert(embeddingModelProperties.getProxy())) - .logRequests(embeddingModelProperties.getLogRequests()) - .logResponses(embeddingModelProperties.getLogResponses()) - .customHeaders(embeddingModelProperties.getCustomHeaders()) + .baseUrl(embeddingModelProperties.baseUrl()) + .apiKey(embeddingModelProperties.apiKey()) + .organizationId(embeddingModelProperties.organizationId()) + .modelName(embeddingModelProperties.modelName()) + .dimensions(embeddingModelProperties.dimensions()) + .user(embeddingModelProperties.user()) + .timeout(embeddingModelProperties.timeout()) + .maxRetries(embeddingModelProperties.maxRetries()) + .proxy(ProxyProperties.convert(embeddingModelProperties.proxy())) + .logRequests(embeddingModelProperties.logRequests()) + .logResponses(embeddingModelProperties.logResponses()) + .customHeaders(embeddingModelProperties.customHeaders()) .build(); } @Bean @ConditionalOnProperty(PREFIX + ".moderation-model.api-key") OpenAiModerationModel openAiModerationModel(Properties properties) { - ModerationModelProperties moderationModelProperties = properties.getModerationModel(); + ModerationModelProperties moderationModelProperties = properties.moderationModel(); return OpenAiModerationModel.builder() - .baseUrl(moderationModelProperties.getBaseUrl()) - .apiKey(moderationModelProperties.getApiKey()) - .organizationId(moderationModelProperties.getOrganizationId()) - .modelName(moderationModelProperties.getModelName()) - .timeout(moderationModelProperties.getTimeout()) - .maxRetries(moderationModelProperties.getMaxRetries()) - .proxy(ProxyProperties.convert(moderationModelProperties.getProxy())) - .logRequests(moderationModelProperties.getLogRequests()) - .logResponses(moderationModelProperties.getLogResponses()) - .customHeaders(moderationModelProperties.getCustomHeaders()) + .baseUrl(moderationModelProperties.baseUrl()) + .apiKey(moderationModelProperties.apiKey()) + .organizationId(moderationModelProperties.organizationId()) + .modelName(moderationModelProperties.modelName()) + .timeout(moderationModelProperties.timeout()) + .maxRetries(moderationModelProperties.maxRetries()) + .proxy(ProxyProperties.convert(moderationModelProperties.proxy())) + .logRequests(moderationModelProperties.logRequests()) + .logResponses(moderationModelProperties.logResponses()) + .customHeaders(moderationModelProperties.customHeaders()) .build(); } @Bean @ConditionalOnProperty(PREFIX + ".image-model.api-key") OpenAiImageModel openAiImageModel(Properties properties) { - ImageModelProperties imageModelProperties = properties.getImageModel(); + ImageModelProperties imageModelProperties = properties.imageModel(); return OpenAiImageModel.builder() - .baseUrl(imageModelProperties.getBaseUrl()) - .apiKey(imageModelProperties.getApiKey()) - .organizationId(imageModelProperties.getOrganizationId()) - .modelName(imageModelProperties.getModelName()) - .size(imageModelProperties.getSize()) - .quality(imageModelProperties.getQuality()) - .style(imageModelProperties.getStyle()) - .user(imageModelProperties.getUser()) - .responseFormat(imageModelProperties.getResponseFormat()) - .timeout(imageModelProperties.getTimeout()) - .maxRetries(imageModelProperties.getMaxRetries()) - .proxy(ProxyProperties.convert(imageModelProperties.getProxy())) - .logRequests(imageModelProperties.getLogRequests()) - .logResponses(imageModelProperties.getLogResponses()) - .withPersisting(imageModelProperties.getWithPersisting()) - .persistTo(imageModelProperties.getPersistTo()) - .customHeaders(imageModelProperties.getCustomHeaders()) + .baseUrl(imageModelProperties.baseUrl()) + .apiKey(imageModelProperties.apiKey()) + .organizationId(imageModelProperties.organizationId()) + .modelName(imageModelProperties.modelName()) + .size(imageModelProperties.size()) + .quality(imageModelProperties.quality()) + .style(imageModelProperties.style()) + .user(imageModelProperties.user()) + .responseFormat(imageModelProperties.responseFormat()) + .timeout(imageModelProperties.timeout()) + .maxRetries(imageModelProperties.maxRetries()) + .proxy(ProxyProperties.convert(imageModelProperties.proxy())) + .logRequests(imageModelProperties.logRequests()) + .logResponses(imageModelProperties.logResponses()) + .withPersisting(imageModelProperties.withPersisting()) + .persistTo(imageModelProperties.persistTo()) + .customHeaders(imageModelProperties.customHeaders()) .build(); } diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ChatModelProperties.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ChatModelProperties.java index 4277630a..f6cfa16d 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ChatModelProperties.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ChatModelProperties.java @@ -1,40 +1,37 @@ package dev.langchain4j.openai.spring; -import lombok.Getter; -import lombok.Setter; import org.springframework.boot.context.properties.NestedConfigurationProperty; import java.time.Duration; import java.util.List; import java.util.Map; -@Getter -@Setter -class ChatModelProperties { +record ChatModelProperties( - String baseUrl; - String apiKey; - String organizationId; - String modelName; - Double temperature; - Double topP; - List stop; - Integer maxTokens; - Integer maxCompletionTokens; - Double presencePenalty; - Double frequencyPenalty; - Map logitBias; - String responseFormat; - Boolean strictJsonSchema; - Integer seed; - String user; - Boolean strictTools; - Boolean parallelToolCalls; - Duration timeout; - Integer maxRetries; + String baseUrl, + String apiKey, + String organizationId, + String modelName, + Double temperature, + Double topP, + List stop, + Integer maxTokens, + Integer maxCompletionTokens, + Double presencePenalty, + Double frequencyPenalty, + Map logitBias, + String responseFormat, + Boolean strictJsonSchema, + Integer seed, + String user, + Boolean strictTools, + Boolean parallelToolCalls, + Duration timeout, + Integer maxRetries, @NestedConfigurationProperty - ProxyProperties proxy; - Boolean logRequests; - Boolean logResponses; - Map customHeaders; + ProxyProperties proxy, + Boolean logRequests, + Boolean logResponses, + Map customHeaders +) { } \ No newline at end of file diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/EmbeddingModelProperties.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/EmbeddingModelProperties.java index fa6b2157..381d0f34 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/EmbeddingModelProperties.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/EmbeddingModelProperties.java @@ -1,27 +1,26 @@ package dev.langchain4j.openai.spring; -import lombok.Getter; -import lombok.Setter; import org.springframework.boot.context.properties.NestedConfigurationProperty; import java.time.Duration; import java.util.Map; -@Getter -@Setter -class EmbeddingModelProperties { - String baseUrl; - String apiKey; - String organizationId; - String modelName; - Integer dimensions; - String user; - Duration timeout; - Integer maxRetries; +record EmbeddingModelProperties( + + String baseUrl, + String apiKey, + String organizationId, + String modelName, + Integer dimensions, + String user, + Duration timeout, + Integer maxRetries, @NestedConfigurationProperty - ProxyProperties proxy; - Boolean logRequests; - Boolean logResponses; - Map customHeaders; + ProxyProperties proxy, + Boolean logRequests, + Boolean logResponses, + Map customHeaders +) { + } \ No newline at end of file diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ImageModelProperties.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ImageModelProperties.java index 793128f0..3d1666fe 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ImageModelProperties.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ImageModelProperties.java @@ -1,33 +1,31 @@ package dev.langchain4j.openai.spring; -import lombok.Getter; -import lombok.Setter; import org.springframework.boot.context.properties.NestedConfigurationProperty; import java.nio.file.Path; import java.time.Duration; import java.util.Map; -@Getter -@Setter -class ImageModelProperties { - String baseUrl; - String apiKey; - String organizationId; - String modelName; - String size; - String quality; - String style; - String user; - String responseFormat; - Duration timeout; - Integer maxRetries; +record ImageModelProperties( + + String baseUrl, + String apiKey, + String organizationId, + String modelName, + String size, + String quality, + String style, + String user, + String responseFormat, + Duration timeout, + Integer maxRetries, @NestedConfigurationProperty - ProxyProperties proxy; - Boolean logRequests; - Boolean logResponses; - Boolean withPersisting; - Path persistTo; - Map customHeaders; + ProxyProperties proxy, + Boolean logRequests, + Boolean logResponses, + Boolean withPersisting, + Path persistTo, + Map customHeaders +) { } \ No newline at end of file diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/LanguageModelProperties.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/LanguageModelProperties.java index 6e8bb55b..fa245c2b 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/LanguageModelProperties.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/LanguageModelProperties.java @@ -1,26 +1,24 @@ package dev.langchain4j.openai.spring; -import lombok.Getter; -import lombok.Setter; import org.springframework.boot.context.properties.NestedConfigurationProperty; import java.time.Duration; import java.util.Map; -@Getter -@Setter -class LanguageModelProperties { - String baseUrl; - String apiKey; - String organizationId; - String modelName; - Double temperature; - Duration timeout; - Integer maxRetries; +record LanguageModelProperties( + + String baseUrl, + String apiKey, + String organizationId, + String modelName, + Double temperature, + Duration timeout, + Integer maxRetries, @NestedConfigurationProperty - ProxyProperties proxy; - Boolean logRequests; - Boolean logResponses; - Map customHeaders; + ProxyProperties proxy, + Boolean logRequests, + Boolean logResponses, + Map customHeaders +) { } \ No newline at end of file diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ModerationModelProperties.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ModerationModelProperties.java index 219011f7..d1b0bc2e 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ModerationModelProperties.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ModerationModelProperties.java @@ -1,25 +1,22 @@ package dev.langchain4j.openai.spring; -import lombok.Getter; -import lombok.Setter; import org.springframework.boot.context.properties.NestedConfigurationProperty; import java.time.Duration; import java.util.Map; -@Getter -@Setter -class ModerationModelProperties { +record ModerationModelProperties( - String baseUrl; - String apiKey; - String organizationId; - String modelName; - Duration timeout; - Integer maxRetries; + String baseUrl, + String apiKey, + String organizationId, + String modelName, + Duration timeout, + Integer maxRetries, @NestedConfigurationProperty - ProxyProperties proxy; - Boolean logRequests; - Boolean logResponses; - Map customHeaders; + ProxyProperties proxy, + Boolean logRequests, + Boolean logResponses, + Map customHeaders +) { } \ No newline at end of file diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/Properties.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/Properties.java index 8cd88766..d7483be6 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/Properties.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/Properties.java @@ -1,35 +1,32 @@ package dev.langchain4j.openai.spring; -import lombok.Getter; -import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; -@Getter -@Setter @ConfigurationProperties(prefix = Properties.PREFIX) -public class Properties { - - static final String PREFIX = "langchain4j.open-ai"; +public record Properties( @NestedConfigurationProperty - ChatModelProperties chatModel; + ChatModelProperties chatModel, @NestedConfigurationProperty - ChatModelProperties streamingChatModel; + ChatModelProperties streamingChatModel, @NestedConfigurationProperty - LanguageModelProperties languageModel; + LanguageModelProperties languageModel, @NestedConfigurationProperty - LanguageModelProperties streamingLanguageModel; + LanguageModelProperties streamingLanguageModel, @NestedConfigurationProperty - EmbeddingModelProperties embeddingModel; + EmbeddingModelProperties embeddingModel, @NestedConfigurationProperty - ModerationModelProperties moderationModel; + ModerationModelProperties moderationModel, @NestedConfigurationProperty - ImageModelProperties imageModel; + ImageModelProperties imageModel +) { + static final String PREFIX = "langchain4j.open-ai"; + } diff --git a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ProxyProperties.java b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ProxyProperties.java index 141af329..14d8c2bc 100644 --- a/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ProxyProperties.java +++ b/langchain4j-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/openai/spring/ProxyProperties.java @@ -1,18 +1,15 @@ package dev.langchain4j.openai.spring; -import lombok.Getter; -import lombok.Setter; import java.net.InetSocketAddress; import java.net.Proxy; -@Getter -@Setter -class ProxyProperties { +record ProxyProperties( - Proxy.Type type; - String host; - Integer port; + Proxy.Type type, + String host, + Integer port +){ static Proxy convert(ProxyProperties proxy) { if (proxy == null) { diff --git a/langchain4j-spring-boot-starter/pom.xml b/langchain4j-spring-boot-starter/pom.xml index 31c67d08..3d7fe46a 100644 --- a/langchain4j-spring-boot-starter/pom.xml +++ b/langchain4j-spring-boot-starter/pom.xml @@ -33,13 +33,6 @@ true - - - org.projectlombok - lombok - provided - - org.springframework.boot diff --git a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RagAutoConfig.java b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RagAutoConfig.java index 67eb1e3b..2e313053 100644 --- a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RagAutoConfig.java +++ b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RagAutoConfig.java @@ -37,11 +37,11 @@ ContentRetriever contentRetriever(EmbeddingModel embeddingModel, .embeddingModel(embeddingModel); if (ragProperties != null) { - RetrievalProperties retrievalProperties = ragProperties.getRetrieval(); + RetrievalProperties retrievalProperties = ragProperties.retrieval(); if (retrievalProperties != null) { builder - .maxResults(retrievalProperties.maxResults) - .minScore(retrievalProperties.minScore); + .maxResults(retrievalProperties.maxResults()) + .minScore(retrievalProperties.minScore()); } } diff --git a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RagProperties.java b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RagProperties.java index dd47aaba..05e99a46 100644 --- a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RagProperties.java +++ b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RagProperties.java @@ -1,17 +1,11 @@ package dev.langchain4j.rag.spring; -import lombok.Getter; -import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; -@Getter -@Setter -@ConfigurationProperties(prefix = RagProperties.PREFIX) -public class RagProperties { +@ConfigurationProperties(prefix = RagProperties.PREFIX) +public record RagProperties(@NestedConfigurationProperty RetrievalProperties retrieval) { static final String PREFIX = "langchain4j.rag"; - @NestedConfigurationProperty - RetrievalProperties retrieval; } diff --git a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RetrievalProperties.java b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RetrievalProperties.java index e8995ced..7b351fc1 100644 --- a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RetrievalProperties.java +++ b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/rag/spring/RetrievalProperties.java @@ -1,12 +1,4 @@ package dev.langchain4j.rag.spring; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -class RetrievalProperties { - - Integer maxResults; - Double minScore; +record RetrievalProperties(Integer maxResults, Double minScore) { } From 59df6a95f680d93f98b672e233866cfadfdff697 Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Thu, 7 Nov 2024 15:51:55 +0100 Subject: [PATCH 04/25] Azure OpenAI: add missing properties/parameters --- .../azure/openai/spring/AutoConfig.java | 54 +++++++++++-------- .../openai/spring/ChatModelProperties.java | 15 +++--- .../spring/EmbeddingModelProperties.java | 8 +-- .../openai/spring/ImageModelProperties.java | 8 +-- 4 files changed, 52 insertions(+), 33 deletions(-) diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java index 74281776..1515fb63 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java @@ -3,11 +3,7 @@ import com.azure.core.http.ProxyOptions; import com.azure.core.util.Configuration; import dev.langchain4j.model.Tokenizer; -import dev.langchain4j.model.azure.AzureOpenAiChatModel; -import dev.langchain4j.model.azure.AzureOpenAiEmbeddingModel; -import dev.langchain4j.model.azure.AzureOpenAiImageModel; -import dev.langchain4j.model.azure.AzureOpenAiStreamingChatModel; -import dev.langchain4j.model.azure.AzureOpenAiTokenizer; +import dev.langchain4j.model.azure.*; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -37,18 +33,25 @@ AzureOpenAiChatModel openAiChatModel(Properties properties) { ChatModelProperties chatModelProperties = properties.getChatModel(); AzureOpenAiChatModel.Builder builder = AzureOpenAiChatModel.builder() .endpoint(chatModelProperties.getEndpoint()) + .serviceVersion(chatModelProperties.getServiceVersion()) .apiKey(chatModelProperties.getApiKey()) .deploymentName(chatModelProperties.getDeploymentName()) + // TODO inject tokenizer? + .maxTokens(chatModelProperties.getMaxTokens()) .temperature(chatModelProperties.getTemperature()) .topP(chatModelProperties.getTopP()) - .maxTokens(chatModelProperties.getMaxTokens()) + .logitBias(chatModelProperties.getLogitBias()) + .user(chatModelProperties.getUser()) + .stop(chatModelProperties.getStop()) .presencePenalty(chatModelProperties.getPresencePenalty()) .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) + .seed(chatModelProperties.getSeed()) .timeout(Duration.ofSeconds(chatModelProperties.getTimeout() == null ? 0 : chatModelProperties.getTimeout())) .maxRetries(chatModelProperties.getMaxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) - .customHeaders(chatModelProperties.getCustomHeaders()) - .logRequestsAndResponses(chatModelProperties.getLogRequestsAndResponses() != null && chatModelProperties.getLogRequestsAndResponses()); + .logRequestsAndResponses(chatModelProperties.getLogRequestsAndResponses() != null && chatModelProperties.getLogRequestsAndResponses()) + .userAgentSuffix(chatModelProperties.getUserAgentSuffix()) + .customHeaders(chatModelProperties.getCustomHeaders()); if (chatModelProperties.getNonAzureApiKey() != null) { builder.nonAzureApiKey(chatModelProperties.getNonAzureApiKey()); } @@ -67,23 +70,29 @@ AzureOpenAiStreamingChatModel openAiStreamingChatModelByNonAzureApiKey(Propertie return openAiStreamingChatModel(properties); } - AzureOpenAiStreamingChatModel openAiStreamingChatModel(Properties properties) { ChatModelProperties chatModelProperties = properties.getStreamingChatModel(); AzureOpenAiStreamingChatModel.Builder builder = AzureOpenAiStreamingChatModel.builder() .endpoint(chatModelProperties.getEndpoint()) + .serviceVersion(chatModelProperties.getServiceVersion()) .apiKey(chatModelProperties.getApiKey()) .deploymentName(chatModelProperties.getDeploymentName()) + // TODO inject tokenizer? + .maxTokens(chatModelProperties.getMaxTokens()) .temperature(chatModelProperties.getTemperature()) .topP(chatModelProperties.getTopP()) + .logitBias(chatModelProperties.getLogitBias()) + .user(chatModelProperties.getUser()) .stop(chatModelProperties.getStop()) - .maxTokens(chatModelProperties.getMaxTokens()) .presencePenalty(chatModelProperties.getPresencePenalty()) .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) + .seed(chatModelProperties.getSeed()) .timeout(Duration.ofSeconds(chatModelProperties.getTimeout() == null ? 0 : chatModelProperties.getTimeout())) + .maxRetries(chatModelProperties.getMaxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) - .customHeaders(chatModelProperties.getCustomHeaders()) - .logRequestsAndResponses(chatModelProperties.getLogRequestsAndResponses() != null && chatModelProperties.getLogRequestsAndResponses()); + .logRequestsAndResponses(chatModelProperties.getLogRequestsAndResponses() != null && chatModelProperties.getLogRequestsAndResponses()) + .userAgentSuffix(chatModelProperties.getUserAgentSuffix()) + .customHeaders(chatModelProperties.getCustomHeaders()); if (chatModelProperties.getNonAzureApiKey() != null) { builder.nonAzureApiKey(chatModelProperties.getNonAzureApiKey()); } @@ -106,15 +115,17 @@ AzureOpenAiEmbeddingModel openAiEmbeddingModel(Properties properties, Tokenizer EmbeddingModelProperties embeddingModelProperties = properties.getEmbeddingModel(); AzureOpenAiEmbeddingModel.Builder builder = AzureOpenAiEmbeddingModel.builder() .endpoint(embeddingModelProperties.getEndpoint()) + .serviceVersion(embeddingModelProperties.getServiceVersion()) .apiKey(embeddingModelProperties.getApiKey()) .deploymentName(embeddingModelProperties.getDeploymentName()) - .maxRetries(embeddingModelProperties.getMaxRetries()) .tokenizer(tokenizer) .timeout(Duration.ofSeconds(embeddingModelProperties.getTimeout() == null ? 0 : embeddingModelProperties.getTimeout())) + .maxRetries(embeddingModelProperties.getMaxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) - .customHeaders(embeddingModelProperties.getCustomHeaders()) - .logRequestsAndResponses(embeddingModelProperties.getLogRequestsAndResponses() != null && embeddingModelProperties.getLogRequestsAndResponses()); - + .logRequestsAndResponses(embeddingModelProperties.getLogRequestsAndResponses() != null && embeddingModelProperties.getLogRequestsAndResponses()) + .userAgentSuffix(embeddingModelProperties.getUserAgentSuffix()) + .dimensions(embeddingModelProperties.getDimensions()) + .customHeaders(embeddingModelProperties.getCustomHeaders()); if (embeddingModelProperties.getNonAzureApiKey() != null) { builder.nonAzureApiKey(embeddingModelProperties.getNonAzureApiKey()); } @@ -137,25 +148,26 @@ AzureOpenAiImageModel openAiImageModel(Properties properties) { ImageModelProperties imageModelProperties = properties.getImageModel(); AzureOpenAiImageModel.Builder builder = AzureOpenAiImageModel.builder() .endpoint(imageModelProperties.getEndpoint()) + .serviceVersion(imageModelProperties.getServiceVersion()) .apiKey(imageModelProperties.getApiKey()) .deploymentName(imageModelProperties.getDeploymentName()) - .size(imageModelProperties.getSize()) .quality(imageModelProperties.getQuality()) - .style(imageModelProperties.getStyle()) + .size(imageModelProperties.getSize()) .user(imageModelProperties.getUser()) + .style(imageModelProperties.getStyle()) .responseFormat(imageModelProperties.getResponseFormat()) .timeout(imageModelProperties.getTimeout() == null ? null : Duration.ofSeconds(imageModelProperties.getTimeout())) .maxRetries(imageModelProperties.getMaxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) - .customHeaders(imageModelProperties.getCustomHeaders()) - .logRequestsAndResponses(imageModelProperties.getLogRequestsAndResponses() != null && imageModelProperties.getLogRequestsAndResponses()); + .logRequestsAndResponses(imageModelProperties.getLogRequestsAndResponses() != null && imageModelProperties.getLogRequestsAndResponses()) + .userAgentSuffix(imageModelProperties.getUserAgentSuffix()) + .customHeaders(imageModelProperties.getCustomHeaders()); if (imageModelProperties.getNonAzureApiKey() != null) { builder.nonAzureApiKey(imageModelProperties.getNonAzureApiKey()); } return builder.build(); } - @Bean @ConditionalOnMissingBean AzureOpenAiTokenizer azureOpenAiTokenizer() { diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java index 5b27eb5c..4535e47e 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java @@ -11,20 +11,23 @@ class ChatModelProperties { String endpoint; + String serviceVersion; String apiKey; - String nonAzureApiKey; - String organizationId; String deploymentName; + Integer maxTokens; Double temperature; Double topP; - Integer maxTokens; + Map logitBias; + String user; + List stop; Double presencePenalty; Double frequencyPenalty; + Long seed; String responseFormat; - Integer seed; - List stop; - Integer timeout; + Integer timeout; // TODO use Duration instead Integer maxRetries; Boolean logRequestsAndResponses; + String userAgentSuffix; Map customHeaders; + String nonAzureApiKey; } \ No newline at end of file diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java index e4140a31..7522e95e 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java @@ -10,12 +10,14 @@ class EmbeddingModelProperties { String endpoint; + String serviceVersion; String apiKey; - String nonAzureApiKey; String deploymentName; - Integer dimensions; - Integer timeout; + Integer timeout; // TODO use duration instead Integer maxRetries; Boolean logRequestsAndResponses; + String userAgentSuffix; + Integer dimensions; Map customHeaders; + String nonAzureApiKey; } \ No newline at end of file diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java index 75d2bd28..aadfcf32 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java @@ -10,16 +10,18 @@ class ImageModelProperties { String endpoint; + String serviceVersion; String apiKey; - String nonAzureApiKey; String deploymentName; - String size; String quality; + String size; + String user; String style; String responseFormat; - String user; Integer timeout; Integer maxRetries; Boolean logRequestsAndResponses; + String userAgentSuffix; Map customHeaders; + String nonAzureApiKey; } \ No newline at end of file From 1ac0350ff4b57e0305d3d0b0cc58762160f99aca Mon Sep 17 00:00:00 2001 From: Antoine Rey Date: Fri, 8 Nov 2024 09:17:14 +0100 Subject: [PATCH 05/25] Get rid of lombok for langchain4j-azure-open-ai-spring-boot-sarter (#51) ## Issue Langchain4j project issue: https://github.com/langchain4j/langchain4j/issues/1636 ## Change Get rid of lombok from the modules: `langchain4j-azure-open-ai-spring-boot-starter`. I'll use java `record` for class annotated with `@ConfigurationProperties`. ## General checklist - [X] There are no breaking changes - [ ] I have added unit and integration tests for my change - [ ] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green - [ ] I have manually run all the unit and integration tests in the [core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core) and [main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j) modules, and they are all green - [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) - [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features) - [ ] I have added/updated [Spring Boot starter(s)](https://github.com/langchain4j/langchain4j-spring) (if applicable) --- .../pom.xml | 7 - .../azure/openai/spring/AutoConfig.java | 144 +++++++++--------- .../openai/spring/ChatModelProperties.java | 48 +++--- .../spring/EmbeddingModelProperties.java | 30 ++-- .../openai/spring/ImageModelProperties.java | 38 +++-- .../azure/openai/spring/Properties.java | 18 +-- 6 files changed, 131 insertions(+), 154 deletions(-) diff --git a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml index f08c4dc4..f642244a 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml @@ -34,13 +34,6 @@ true - - - org.projectlombok - lombok - provided - - org.springframework.boot diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java index 1515fb63..6d96d798 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java @@ -30,30 +30,30 @@ AzureOpenAiChatModel openAiChatModelByNonAzureApiKey(Properties properties) { } AzureOpenAiChatModel openAiChatModel(Properties properties) { - ChatModelProperties chatModelProperties = properties.getChatModel(); + ChatModelProperties chatModelProperties = properties.chatModel(); AzureOpenAiChatModel.Builder builder = AzureOpenAiChatModel.builder() - .endpoint(chatModelProperties.getEndpoint()) - .serviceVersion(chatModelProperties.getServiceVersion()) - .apiKey(chatModelProperties.getApiKey()) - .deploymentName(chatModelProperties.getDeploymentName()) + .endpoint(chatModelProperties.endpoint()) + .serviceVersion(chatModelProperties.serviceVersion()) + .apiKey(chatModelProperties.apiKey()) + .deploymentName(chatModelProperties.deploymentName()) // TODO inject tokenizer? - .maxTokens(chatModelProperties.getMaxTokens()) - .temperature(chatModelProperties.getTemperature()) - .topP(chatModelProperties.getTopP()) - .logitBias(chatModelProperties.getLogitBias()) - .user(chatModelProperties.getUser()) - .stop(chatModelProperties.getStop()) - .presencePenalty(chatModelProperties.getPresencePenalty()) - .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) - .seed(chatModelProperties.getSeed()) - .timeout(Duration.ofSeconds(chatModelProperties.getTimeout() == null ? 0 : chatModelProperties.getTimeout())) - .maxRetries(chatModelProperties.getMaxRetries()) + .maxTokens(chatModelProperties.maxTokens()) + .temperature(chatModelProperties.temperature()) + .topP(chatModelProperties.topP()) + .logitBias(chatModelProperties.logitBias()) + .user(chatModelProperties.user()) + .stop(chatModelProperties.stop()) + .presencePenalty(chatModelProperties.presencePenalty()) + .frequencyPenalty(chatModelProperties.frequencyPenalty()) + .seed(chatModelProperties.seed()) + .timeout(Duration.ofSeconds(chatModelProperties.timeout() == null ? 0 : chatModelProperties.timeout())) + .maxRetries(chatModelProperties.maxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) - .logRequestsAndResponses(chatModelProperties.getLogRequestsAndResponses() != null && chatModelProperties.getLogRequestsAndResponses()) - .userAgentSuffix(chatModelProperties.getUserAgentSuffix()) - .customHeaders(chatModelProperties.getCustomHeaders()); - if (chatModelProperties.getNonAzureApiKey() != null) { - builder.nonAzureApiKey(chatModelProperties.getNonAzureApiKey()); + .logRequestsAndResponses(chatModelProperties.logRequestsAndResponses() != null && chatModelProperties.logRequestsAndResponses()) + .userAgentSuffix(chatModelProperties.userAgentSuffix()) + .customHeaders(chatModelProperties.customHeaders()); + if (chatModelProperties.nonAzureApiKey() != null) { + builder.nonAzureApiKey(chatModelProperties.nonAzureApiKey()); } return builder.build(); } @@ -71,30 +71,30 @@ AzureOpenAiStreamingChatModel openAiStreamingChatModelByNonAzureApiKey(Propertie } AzureOpenAiStreamingChatModel openAiStreamingChatModel(Properties properties) { - ChatModelProperties chatModelProperties = properties.getStreamingChatModel(); + ChatModelProperties chatModelProperties = properties.streamingChatModel(); AzureOpenAiStreamingChatModel.Builder builder = AzureOpenAiStreamingChatModel.builder() - .endpoint(chatModelProperties.getEndpoint()) - .serviceVersion(chatModelProperties.getServiceVersion()) - .apiKey(chatModelProperties.getApiKey()) - .deploymentName(chatModelProperties.getDeploymentName()) + .endpoint(chatModelProperties.endpoint()) + .serviceVersion(chatModelProperties.serviceVersion()) + .apiKey(chatModelProperties.apiKey()) + .deploymentName(chatModelProperties.deploymentName()) // TODO inject tokenizer? - .maxTokens(chatModelProperties.getMaxTokens()) - .temperature(chatModelProperties.getTemperature()) - .topP(chatModelProperties.getTopP()) - .logitBias(chatModelProperties.getLogitBias()) - .user(chatModelProperties.getUser()) - .stop(chatModelProperties.getStop()) - .presencePenalty(chatModelProperties.getPresencePenalty()) - .frequencyPenalty(chatModelProperties.getFrequencyPenalty()) - .seed(chatModelProperties.getSeed()) - .timeout(Duration.ofSeconds(chatModelProperties.getTimeout() == null ? 0 : chatModelProperties.getTimeout())) - .maxRetries(chatModelProperties.getMaxRetries()) + .maxTokens(chatModelProperties.maxTokens()) + .temperature(chatModelProperties.temperature()) + .topP(chatModelProperties.topP()) + .logitBias(chatModelProperties.logitBias()) + .user(chatModelProperties.user()) + .stop(chatModelProperties.stop()) + .presencePenalty(chatModelProperties.presencePenalty()) + .frequencyPenalty(chatModelProperties.frequencyPenalty()) + .seed(chatModelProperties.seed()) + .timeout(Duration.ofSeconds(chatModelProperties.timeout() == null ? 0 : chatModelProperties.timeout())) + .maxRetries(chatModelProperties.maxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) - .logRequestsAndResponses(chatModelProperties.getLogRequestsAndResponses() != null && chatModelProperties.getLogRequestsAndResponses()) - .userAgentSuffix(chatModelProperties.getUserAgentSuffix()) - .customHeaders(chatModelProperties.getCustomHeaders()); - if (chatModelProperties.getNonAzureApiKey() != null) { - builder.nonAzureApiKey(chatModelProperties.getNonAzureApiKey()); + .logRequestsAndResponses(chatModelProperties.logRequestsAndResponses() != null && chatModelProperties.logRequestsAndResponses()) + .userAgentSuffix(chatModelProperties.userAgentSuffix()) + .customHeaders(chatModelProperties.customHeaders()); + if (chatModelProperties.nonAzureApiKey() != null) { + builder.nonAzureApiKey(chatModelProperties.nonAzureApiKey()); } return builder.build(); } @@ -112,22 +112,22 @@ AzureOpenAiEmbeddingModel openAiEmbeddingModelByNonAzureApiKey(Properties proper } AzureOpenAiEmbeddingModel openAiEmbeddingModel(Properties properties, Tokenizer tokenizer) { - EmbeddingModelProperties embeddingModelProperties = properties.getEmbeddingModel(); + EmbeddingModelProperties embeddingModelProperties = properties.embeddingModel(); AzureOpenAiEmbeddingModel.Builder builder = AzureOpenAiEmbeddingModel.builder() - .endpoint(embeddingModelProperties.getEndpoint()) - .serviceVersion(embeddingModelProperties.getServiceVersion()) - .apiKey(embeddingModelProperties.getApiKey()) - .deploymentName(embeddingModelProperties.getDeploymentName()) + .endpoint(embeddingModelProperties.endpoint()) + .serviceVersion(embeddingModelProperties.serviceVersion()) + .apiKey(embeddingModelProperties.apiKey()) + .deploymentName(embeddingModelProperties.deploymentName()) .tokenizer(tokenizer) - .timeout(Duration.ofSeconds(embeddingModelProperties.getTimeout() == null ? 0 : embeddingModelProperties.getTimeout())) - .maxRetries(embeddingModelProperties.getMaxRetries()) + .timeout(Duration.ofSeconds(embeddingModelProperties.timeout() == null ? 0 : embeddingModelProperties.timeout())) + .maxRetries(embeddingModelProperties.maxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) - .logRequestsAndResponses(embeddingModelProperties.getLogRequestsAndResponses() != null && embeddingModelProperties.getLogRequestsAndResponses()) - .userAgentSuffix(embeddingModelProperties.getUserAgentSuffix()) - .dimensions(embeddingModelProperties.getDimensions()) - .customHeaders(embeddingModelProperties.getCustomHeaders()); - if (embeddingModelProperties.getNonAzureApiKey() != null) { - builder.nonAzureApiKey(embeddingModelProperties.getNonAzureApiKey()); + .logRequestsAndResponses(embeddingModelProperties.logRequestsAndResponses() != null && embeddingModelProperties.logRequestsAndResponses()) + .userAgentSuffix(embeddingModelProperties.userAgentSuffix()) + .dimensions(embeddingModelProperties.dimensions()) + .customHeaders(embeddingModelProperties.customHeaders()); + if (embeddingModelProperties.nonAzureApiKey() != null) { + builder.nonAzureApiKey(embeddingModelProperties.nonAzureApiKey()); } return builder.build(); } @@ -145,25 +145,25 @@ AzureOpenAiImageModel openAiImageModelByNonAzureApiKey(Properties properties) { } AzureOpenAiImageModel openAiImageModel(Properties properties) { - ImageModelProperties imageModelProperties = properties.getImageModel(); + ImageModelProperties imageModelProperties = properties.imageModel(); AzureOpenAiImageModel.Builder builder = AzureOpenAiImageModel.builder() - .endpoint(imageModelProperties.getEndpoint()) - .serviceVersion(imageModelProperties.getServiceVersion()) - .apiKey(imageModelProperties.getApiKey()) - .deploymentName(imageModelProperties.getDeploymentName()) - .quality(imageModelProperties.getQuality()) - .size(imageModelProperties.getSize()) - .user(imageModelProperties.getUser()) - .style(imageModelProperties.getStyle()) - .responseFormat(imageModelProperties.getResponseFormat()) - .timeout(imageModelProperties.getTimeout() == null ? null : Duration.ofSeconds(imageModelProperties.getTimeout())) - .maxRetries(imageModelProperties.getMaxRetries()) + .endpoint(imageModelProperties.endpoint()) + .serviceVersion(imageModelProperties.serviceVersion()) + .apiKey(imageModelProperties.apiKey()) + .deploymentName(imageModelProperties.deploymentName()) + .quality(imageModelProperties.quality()) + .size(imageModelProperties.size()) + .user(imageModelProperties.user()) + .style(imageModelProperties.style()) + .responseFormat(imageModelProperties.responseFormat()) + .timeout(imageModelProperties.timeout() == null ? null : Duration.ofSeconds(imageModelProperties.timeout())) + .maxRetries(imageModelProperties.maxRetries()) .proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration())) - .logRequestsAndResponses(imageModelProperties.getLogRequestsAndResponses() != null && imageModelProperties.getLogRequestsAndResponses()) - .userAgentSuffix(imageModelProperties.getUserAgentSuffix()) - .customHeaders(imageModelProperties.getCustomHeaders()); - if (imageModelProperties.getNonAzureApiKey() != null) { - builder.nonAzureApiKey(imageModelProperties.getNonAzureApiKey()); + .logRequestsAndResponses(imageModelProperties.logRequestsAndResponses() != null && imageModelProperties.logRequestsAndResponses()) + .userAgentSuffix(imageModelProperties.userAgentSuffix()) + .customHeaders(imageModelProperties.customHeaders()); + if (imageModelProperties.nonAzureApiKey() != null) { + builder.nonAzureApiKey(imageModelProperties.nonAzureApiKey()); } return builder.build(); } diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java index 4535e47e..5835406e 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java @@ -1,33 +1,29 @@ package dev.langchain4j.azure.openai.spring; -import lombok.Getter; -import lombok.Setter; - import java.util.List; import java.util.Map; -@Getter -@Setter -class ChatModelProperties { +record ChatModelProperties( - String endpoint; - String serviceVersion; - String apiKey; - String deploymentName; - Integer maxTokens; - Double temperature; - Double topP; - Map logitBias; - String user; - List stop; - Double presencePenalty; - Double frequencyPenalty; - Long seed; - String responseFormat; - Integer timeout; // TODO use Duration instead - Integer maxRetries; - Boolean logRequestsAndResponses; - String userAgentSuffix; - Map customHeaders; - String nonAzureApiKey; + String endpoint, + String serviceVersion, + String apiKey, + String deploymentName, + Integer maxTokens, + Double temperature, + Double topP, + Map logitBias, + String user, + List stop, + Double presencePenalty, + Double frequencyPenalty, + Long seed, + String responseFormat, + Integer timeout, // TODO use Duration instead + Integer maxRetries, + Boolean logRequestsAndResponses, + String userAgentSuffix, + Map customHeaders, + String nonAzureApiKey +) { } \ No newline at end of file diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java index 7522e95e..daea6335 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java @@ -1,23 +1,19 @@ package dev.langchain4j.azure.openai.spring; -import lombok.Getter; -import lombok.Setter; - import java.util.Map; -@Getter -@Setter -class EmbeddingModelProperties { +record EmbeddingModelProperties( - String endpoint; - String serviceVersion; - String apiKey; - String deploymentName; - Integer timeout; // TODO use duration instead - Integer maxRetries; - Boolean logRequestsAndResponses; - String userAgentSuffix; - Integer dimensions; - Map customHeaders; - String nonAzureApiKey; + String endpoint, + String serviceVersion, + String apiKey, + String deploymentName, + Integer timeout, // TODO use duration instead + Integer maxRetries, + Boolean logRequestsAndResponses, + String userAgentSuffix, + Integer dimensions, + Map customHeaders, + String nonAzureApiKey +) { } \ No newline at end of file diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java index aadfcf32..a7299a6b 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java @@ -1,27 +1,23 @@ package dev.langchain4j.azure.openai.spring; -import lombok.Getter; -import lombok.Setter; - import java.util.Map; -@Getter -@Setter -class ImageModelProperties { +record ImageModelProperties( - String endpoint; - String serviceVersion; - String apiKey; - String deploymentName; - String quality; - String size; - String user; - String style; - String responseFormat; - Integer timeout; - Integer maxRetries; - Boolean logRequestsAndResponses; - String userAgentSuffix; - Map customHeaders; - String nonAzureApiKey; + String endpoint, + String serviceVersion, + String apiKey, + String deploymentName, + String quality, + String size, + String user, + String style, + String responseFormat, + Integer timeout, + Integer maxRetries, + Boolean logRequestsAndResponses, + String userAgentSuffix, + Map customHeaders, + String nonAzureApiKey +){ } \ No newline at end of file diff --git a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/Properties.java b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/Properties.java index da11552b..c0e350b2 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/Properties.java +++ b/langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/Properties.java @@ -1,26 +1,22 @@ package dev.langchain4j.azure.openai.spring; -import lombok.Getter; -import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; -@Getter -@Setter @ConfigurationProperties(prefix = Properties.PREFIX) -public class Properties { - - static final String PREFIX = "langchain4j.azure-open-ai"; +public record Properties( @NestedConfigurationProperty - ChatModelProperties chatModel; + ChatModelProperties chatModel, @NestedConfigurationProperty - ChatModelProperties streamingChatModel; + ChatModelProperties streamingChatModel, @NestedConfigurationProperty - EmbeddingModelProperties embeddingModel; + EmbeddingModelProperties embeddingModel, @NestedConfigurationProperty - ImageModelProperties imageModel; + ImageModelProperties imageModel +) { + static final String PREFIX = "langchain4j.azure-open-ai"; } From 017b20595cfd2df7404203b8e45b249690aba345 Mon Sep 17 00:00:00 2001 From: Necrosis <60231561+N3cr0s1s@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:03:39 +0100 Subject: [PATCH 06/25] fix #1193 ModerationModel is not auto configured (#52) Fix issue [langchain4j/langchain4j#1193](https://github.com/langchain4j/langchain4j/issues/1193) Added ModerationModel support to `AiService`,`AiServiceFactory` and `AiServiceAutoConfig` --- .../langchain4j/service/spring/AiService.java | 9 ++++- .../service/spring/AiServiceFactory.java | 10 +++++ .../service/spring/AiServicesAutoConfig.java | 12 ++++++ .../AiServiceWithModerationModel.java | 12 ++++++ ...ServiceWithModerationModelApplication.java | 34 +++++++++++++++++ .../AiServiceWithModerationModelIT.java | 38 +++++++++++++++++++ 6 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModel.java create mode 100644 langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModelApplication.java create mode 100644 langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModelIT.java diff --git a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiService.java b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiService.java index 169c3f7e..43794649 100644 --- a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiService.java +++ b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiService.java @@ -5,6 +5,7 @@ import dev.langchain4j.memory.chat.ChatMemoryProvider; import dev.langchain4j.model.chat.ChatLanguageModel; import dev.langchain4j.model.chat.StreamingChatLanguageModel; +import dev.langchain4j.model.moderation.ModerationModel; import dev.langchain4j.rag.RetrievalAugmentor; import dev.langchain4j.rag.content.retriever.ContentRetriever; import dev.langchain4j.service.AiServices; @@ -91,9 +92,15 @@ */ String retrievalAugmentor() default ""; + /** + * When the {@link #wiringMode()} is set to {@link AiServiceWiringMode#EXPLICIT}, + * this attribute specifies the name of a {@link ModerationModel} bean that should be used by this AI Service. + */ + String moderationModel() default ""; + /** * When the {@link #wiringMode()} is set to {@link AiServiceWiringMode#EXPLICIT}, * this attribute specifies the names of beans containing methods annotated with {@link Tool} that should be used by this AI Service. */ String[] tools() default {}; -} \ No newline at end of file +} diff --git a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServiceFactory.java b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServiceFactory.java index 7e215c8e..e2a2bdfc 100644 --- a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServiceFactory.java +++ b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServiceFactory.java @@ -4,6 +4,7 @@ import dev.langchain4j.memory.chat.ChatMemoryProvider; import dev.langchain4j.model.chat.ChatLanguageModel; import dev.langchain4j.model.chat.StreamingChatLanguageModel; +import dev.langchain4j.model.moderation.ModerationModel; import dev.langchain4j.rag.RetrievalAugmentor; import dev.langchain4j.rag.content.retriever.ContentRetriever; import dev.langchain4j.service.AiServices; @@ -22,6 +23,7 @@ class AiServiceFactory implements FactoryBean { private ChatMemoryProvider chatMemoryProvider; private ContentRetriever contentRetriever; private RetrievalAugmentor retrievalAugmentor; + private ModerationModel moderationModel; private List tools; public AiServiceFactory(Class aiServiceClass) { @@ -52,6 +54,10 @@ public void setRetrievalAugmentor(RetrievalAugmentor retrievalAugmentor) { this.retrievalAugmentor = retrievalAugmentor; } + public void setModerationModel(ModerationModel moderationModel) { + this.moderationModel = moderationModel; + } + public void setTools(List tools) { this.tools = tools; } @@ -83,6 +89,10 @@ public Object getObject() { builder = builder.contentRetriever(contentRetriever); } + if (moderationModel != null) { + builder = builder.moderationModel(moderationModel); + } + if (!isNullOrEmpty(tools)) { builder = builder.tools(tools); } diff --git a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServicesAutoConfig.java b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServicesAutoConfig.java index 575769e8..90567db3 100644 --- a/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServicesAutoConfig.java +++ b/langchain4j-spring-boot-starter/src/main/java/dev/langchain4j/service/spring/AiServicesAutoConfig.java @@ -6,6 +6,7 @@ import dev.langchain4j.memory.chat.ChatMemoryProvider; import dev.langchain4j.model.chat.ChatLanguageModel; import dev.langchain4j.model.chat.StreamingChatLanguageModel; +import dev.langchain4j.model.moderation.ModerationModel; import dev.langchain4j.rag.RetrievalAugmentor; import dev.langchain4j.rag.content.retriever.ContentRetriever; import org.springframework.beans.MutablePropertyValues; @@ -43,6 +44,7 @@ BeanFactoryPostProcessor aiServicesRegisteringBeanFactoryPostProcessor() { String[] chatMemoryProviders = beanFactory.getBeanNamesForType(ChatMemoryProvider.class); String[] contentRetrievers = beanFactory.getBeanNamesForType(ContentRetriever.class); String[] retrievalAugmentors = beanFactory.getBeanNamesForType(RetrievalAugmentor.class); + String[] moderationModels = beanFactory.getBeanNamesForType(ModerationModel.class); Set tools = new HashSet<>(); for (String beanName : beanFactory.getBeanDefinitionNames()) { @@ -129,6 +131,16 @@ BeanFactoryPostProcessor aiServicesRegisteringBeanFactoryPostProcessor() { propertyValues ); + addBeanReference( + ModerationModel.class, + aiServiceAnnotation, + aiServiceAnnotation.moderationModel(), + moderationModels, + "moderationModel", + "moderationModel", + propertyValues + ); + if (aiServiceAnnotation.wiringMode() == EXPLICIT) { propertyValues.add("tools", toManagedList(asList(aiServiceAnnotation.tools()))); } else if (aiServiceAnnotation.wiringMode() == AUTOMATIC) { diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModel.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModel.java new file mode 100644 index 00000000..c68abcc9 --- /dev/null +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModel.java @@ -0,0 +1,12 @@ +package dev.langchain4j.service.spring.mode.automatic.withModerationModel; + +import dev.langchain4j.service.Moderate; +import dev.langchain4j.service.spring.AiService; + +@AiService +interface AiServiceWithModerationModel { + + @Moderate + String chat(String userMessage); + +} diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModelApplication.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModelApplication.java new file mode 100644 index 00000000..3343c073 --- /dev/null +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModelApplication.java @@ -0,0 +1,34 @@ +package dev.langchain4j.service.spring.mode.automatic.withModerationModel; + +import dev.langchain4j.data.message.ChatMessage; +import dev.langchain4j.model.moderation.Moderation; +import dev.langchain4j.model.moderation.ModerationModel; +import dev.langchain4j.model.output.Response; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +import java.util.List; + +@SpringBootApplication +class AiServiceWithModerationModelApplication { + + @Bean + ModerationModel moderationModel() { + return new ModerationModel() { + @Override + public Response moderate(String s) { + return Response.from(Moderation.flagged("Flagged")); + } + + @Override + public Response moderate(List list) { + return Response.from(Moderation.flagged("Flagged")); + } + }; + } + + public static void main(String[] args) { + SpringApplication.run(AiServiceWithModerationModelApplication.class, args); + } +} diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModelIT.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModelIT.java new file mode 100644 index 00000000..90d6a0d8 --- /dev/null +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/automatic/withModerationModel/AiServiceWithModerationModelIT.java @@ -0,0 +1,38 @@ +package dev.langchain4j.service.spring.mode.automatic.withModerationModel; + +import dev.langchain4j.service.ModerationException; +import dev.langchain4j.service.spring.AiServicesAutoConfig; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; + +import static dev.langchain4j.service.spring.mode.ApiKeys.OPENAI_API_KEY; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +class AiServiceWithModerationModelIT { + + ApplicationContextRunner contextRunner = new ApplicationContextRunner() + .withConfiguration(AutoConfigurations.of(AiServicesAutoConfig.class)); + + @Test + void should_create_AI_service_with_moderation_model() { + contextRunner + .withPropertyValues( + "langchain4j.open-ai.chat-model.api-key=" + OPENAI_API_KEY, + "langchain4j.open-ai.chat-model.max-tokens=20", + "langchain4j.open-ai.chat-model.temperature=0.0" + ) + .withUserConfiguration(AiServiceWithModerationModelApplication.class) + .run(context -> { + + // given + AiServiceWithModerationModel aiService = context.getBean(AiServiceWithModerationModel.class); + + // when & then + assertThatThrownBy(() -> aiService.chat("I'm violating content policy")) + .isInstanceOf(ModerationException.class) + .hasMessageContaining("Flagged"); + + }); + } +} From 91c8ac08b5db4bcfcf9ed605a9539a0c1be0252e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:38:24 +0100 Subject: [PATCH 07/25] Configure Renovate (#53) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Welcome to [Renovate](https://redirect.github.com/renovatebot/renovate)! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin. 🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged. --- ### Detected Package Files * `.github/workflows/main.yaml` (github-actions) * `.github/workflows/release.yaml` (github-actions) * `.github/workflows/snapshot_release.yaml` (github-actions) * `langchain4j-anthropic-spring-boot-starter/pom.xml` (maven) * `langchain4j-azure-ai-search-spring-boot-starter/pom.xml` (maven) * `langchain4j-azure-open-ai-spring-boot-starter/pom.xml` (maven) * `langchain4j-dashscope-spring-boot-starter/pom.xml` (maven) * `langchain4j-easy-rag-spring-boot-starter/pom.xml` (maven) * `langchain4j-elasticsearch-spring-boot-starter/pom.xml` (maven) * `langchain4j-github-models-spring-boot-starter/pom.xml` (maven) * `langchain4j-milvus-spring-boot-starter/pom.xml` (maven) * `langchain4j-ollama-spring-boot-starter/pom.xml` (maven) * `langchain4j-open-ai-spring-boot-starter/pom.xml` (maven) * `langchain4j-qianfan-spring-boot-starter/pom.xml` (maven) * `langchain4j-reactor/pom.xml` (maven) * `langchain4j-redis-spring-boot-starter/pom.xml` (maven) * `langchain4j-spring-boot-starter/pom.xml` (maven) * `langchain4j-spring-boot-tests/pom.xml` (maven) * `langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml` (maven) * `langchain4j-voyage-ai-spring-boot-starter/pom.xml` (maven) * `pom.xml` (maven) * `.mvn/wrapper/maven-wrapper.properties` (maven-wrapper) ### Configuration Summary Based on the default config's presets, Renovate will: - Start dependency updates only once this onboarding PR is merged - Show all Merge Confidence badges for pull requests. - Enable Renovate Dependency Dashboard creation. - Use semantic commit type `fix` for dependencies and `chore` for all others if semantic commits are in use. - Ignore `node_modules`, `bower_components`, `vendor` and various test/tests (except for nuget) directories. - Group known monorepo packages together. - Use curated list of recommended non-monorepo package groupings. - Apply crowd-sourced package replacement rules. - Apply crowd-sourced workarounds for known problems with packages. 🔡 Do you want to change how Renovate upgrades your dependencies? Add your custom config to `renovate.json` in this branch. Renovate will update the Pull Request description the next time it runs. --- ### What to Expect With your current configuration, Renovate will create 18 Pull Requests:
Update dependency io.projectreactor:reactor-core to v3.6.11 - Schedule: ["at any time"] - Branch name: `renovate/io.projectreactor-reactor-core-3.x` - Merge into: `main` - Upgrade [io.projectreactor:reactor-core](https://redirect.github.com/reactor/reactor-core) to `3.6.11`
Update dependency io.projectreactor:reactor-test to v3.6.11 - Schedule: ["at any time"] - Branch name: `renovate/io.projectreactor-reactor-test-3.x` - Merge into: `main` - Upgrade [io.projectreactor:reactor-test](https://redirect.github.com/reactor/reactor-core) to `3.6.11`
Update dependency maven to v3.9.9 - Schedule: ["at any time"] - Branch name: `renovate/maven-3.x` - Merge into: `main` - Upgrade maven to `3.9.9`
Update dependency org.apache.maven.plugins:maven-source-plugin to v3.3.1 - Schedule: ["at any time"] - Branch name: `renovate/org.apache.maven.plugins-maven-source-plugin-3.x` - Merge into: `main` - Upgrade org.apache.maven.plugins:maven-source-plugin to `3.3.1`
Update dependency org.honton.chas:license-maven-plugin to v0.0.6 - Schedule: ["at any time"] - Branch name: `renovate/org.honton.chas-license-maven-plugin-0.x` - Merge into: `main` - Upgrade org.honton.chas:license-maven-plugin to `0.0.6`
Update dependency org.projectlombok:lombok to v1.18.34 - Schedule: ["at any time"] - Branch name: `renovate/org.projectlombok-lombok-1.x` - Merge into: `main` - Upgrade [org.projectlombok:lombok](https://redirect.github.com/projectlombok/lombok) to `1.18.34`
Update dependency org.testcontainers:testcontainers-bom to v1.20.3 - Schedule: ["at any time"] - Branch name: `renovate/testcontainers-java-monorepo` - Merge into: `main` - Upgrade [org.testcontainers:testcontainers-bom](https://redirect.github.com/testcontainers/testcontainers-java) to `1.20.3`
Update dependency maven-wrapper to v3.3.2 - Schedule: ["at any time"] - Branch name: `renovate/maven-wrapper-3.x` - Merge into: `main` - Upgrade maven-wrapper to `3.3.2`
Update dependency org.apache.maven.plugins:maven-failsafe-plugin to v3.5.2 - Schedule: ["at any time"] - Branch name: `renovate/org.apache.maven.plugins-maven-failsafe-plugin-3.x` - Merge into: `main` - Upgrade org.apache.maven.plugins:maven-failsafe-plugin to `3.5.2`
Update dependency org.apache.maven.plugins:maven-gpg-plugin to v3.2.7 - Schedule: ["at any time"] - Branch name: `renovate/org.apache.maven.plugins-maven-gpg-plugin-3.x` - Merge into: `main` - Upgrade org.apache.maven.plugins:maven-gpg-plugin to `3.2.7`
Update dependency org.apache.maven.plugins:maven-jar-plugin to v3.4.2 - Schedule: ["at any time"] - Branch name: `renovate/org.apache.maven.plugins-maven-jar-plugin-3.x` - Merge into: `main` - Upgrade org.apache.maven.plugins:maven-jar-plugin to `3.4.2`
Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.11.1 - Schedule: ["at any time"] - Branch name: `renovate/org.apache.maven.plugins-maven-javadoc-plugin-3.x` - Merge into: `main` - Upgrade org.apache.maven.plugins:maven-javadoc-plugin to `3.11.1`
Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.2 - Schedule: ["at any time"] - Branch name: `renovate/org.apache.maven.plugins-maven-surefire-plugin-3.x` - Merge into: `main` - Upgrade org.apache.maven.plugins:maven-surefire-plugin to `3.5.2`
Update dependency org.assertj:assertj-core to v3.26.3 - Schedule: ["at any time"] - Branch name: `renovate/org.assertj-assertj-core-3.x` - Merge into: `main` - Upgrade [org.assertj:assertj-core](https://redirect.github.com/assertj/assertj) to `3.26.3`
Update dependency org.junit.jupiter:junit-jupiter-engine to v5.11.3 - Schedule: ["at any time"] - Branch name: `renovate/junit5-monorepo` - Merge into: `main` - Upgrade [org.junit.jupiter:junit-jupiter-engine](https://redirect.github.com/junit-team/junit5) to `5.11.3`
Update dependency org.sonatype.plugins:nexus-staging-maven-plugin to v1.7.0 - Schedule: ["at any time"] - Branch name: `renovate/org.sonatype.plugins-nexus-staging-maven-plugin-1.x` - Merge into: `main` - Upgrade [org.sonatype.plugins:nexus-staging-maven-plugin](https://redirect.github.com/sonatype/nexus-maven-plugins) to `1.7.0`
Update spring boot to v3.3.5 - Schedule: ["at any time"] - Branch name: `renovate/spring-boot` - Merge into: `main` - Upgrade [org.springframework.boot:spring-boot-starter-test](https://redirect.github.com/spring-projects/spring-boot) to `3.3.5` - Upgrade [org.springframework.boot:spring-boot-configuration-processor](https://redirect.github.com/spring-projects/spring-boot) to `3.3.5` - Upgrade [org.springframework.boot:spring-boot-autoconfigure-processor](https://redirect.github.com/spring-projects/spring-boot) to `3.3.5` - Upgrade [org.springframework.boot:spring-boot-starter-webflux](https://redirect.github.com/spring-projects/spring-boot) to `3.3.5` - Upgrade [org.springframework.boot:spring-boot-starter](https://redirect.github.com/spring-projects/spring-boot) to `3.3.5`
Update tinylog.version to v2.7.0 - Schedule: ["at any time"] - Branch name: `renovate/tinylog.version` - Merge into: `main` - Upgrade [org.tinylog:slf4j-tinylog](https://redirect.github.com/tinylog-org/tinylog) to `2.7.0` - Upgrade [org.tinylog:tinylog-impl](https://redirect.github.com/tinylog-org/tinylog) to `2.7.0`
🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or overwhelm the project. See docs for `prhourlylimit` for details. --- ❓ Got questions? Check out Renovate's [Docs](https://docs.renovatebot.com/), particularly the Getting Started section. If you need any further assistance then you can also [request help here](https://redirect.github.com/renovatebot/renovate/discussions). --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- renovate.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..5db72dd6 --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ] +} From 7dba539ccd54b21e119cfe26c2482ce6c9d39e4f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:03:24 +0100 Subject: [PATCH 08/25] Update dependency io.projectreactor:reactor-test to v3.6.11 (#55) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [io.projectreactor:reactor-test](https://redirect.github.com/reactor/reactor-core) | `3.6.10` -> `3.6.11` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.projectreactor:reactor-test/3.6.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.projectreactor:reactor-test/3.6.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.projectreactor:reactor-test/3.6.10/3.6.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.projectreactor:reactor-test/3.6.10/3.6.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
reactor/reactor-core (io.projectreactor:reactor-test) ### [`v3.6.11`](https://redirect.github.com/reactor/reactor-core/releases/tag/v3.6.11) `Reactor Core` `3.6.11` is part of **`2023.0.11` Release Train**. ##### What's Changed ##### :sparkles: New features and improvements - Bump `byteBuddy` to version `1.15.4` by [@​dependabot](https://redirect.github.com/dependabot) in [#​3905](https://redirect.github.com/reactor/reactor-core/issues/3905) - Bump `Micrometer` to version `1.12.11` by [@​violetagg](https://redirect.github.com/violetagg) in [`149aeaf`](https://redirect.github.com/reactor/reactor-core/commit/149aeaf3981cf1d61d8c29cb128dda362031ebe5) **Full Changelog**: https://github.com/reactor/reactor-core/compare/v3.6.10...v3.6.11
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- langchain4j-reactor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain4j-reactor/pom.xml b/langchain4j-reactor/pom.xml index ce5428eb..141aa5e8 100644 --- a/langchain4j-reactor/pom.xml +++ b/langchain4j-reactor/pom.xml @@ -33,7 +33,7 @@ io.projectreactor reactor-test - 3.6.10 + 3.6.11 test From 9135fca65395517455bf3fc0e97866d87e228295 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:03:37 +0100 Subject: [PATCH 09/25] Update dependency io.projectreactor:reactor-core to v3.6.11 (#54) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [io.projectreactor:reactor-core](https://redirect.github.com/reactor/reactor-core) | `3.6.10` -> `3.6.11` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.projectreactor:reactor-core/3.6.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.projectreactor:reactor-core/3.6.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.projectreactor:reactor-core/3.6.10/3.6.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.projectreactor:reactor-core/3.6.10/3.6.11?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
reactor/reactor-core (io.projectreactor:reactor-core) ### [`v3.6.11`](https://redirect.github.com/reactor/reactor-core/releases/tag/v3.6.11) [Compare Source](https://redirect.github.com/reactor/reactor-core/compare/v3.6.10...v3.6.11) `Reactor Core` `3.6.11` is part of **`2023.0.11` Release Train**. ##### What's Changed ##### :sparkles: New features and improvements - Bump `byteBuddy` to version `1.15.4` by [@​dependabot](https://redirect.github.com/dependabot) in [#​3905](https://redirect.github.com/reactor/reactor-core/issues/3905) - Bump `Micrometer` to version `1.12.11` by [@​violetagg](https://redirect.github.com/violetagg) in [`149aeaf`](https://redirect.github.com/reactor/reactor-core/commit/149aeaf3981cf1d61d8c29cb128dda362031ebe5) **Full Changelog**: https://github.com/reactor/reactor-core/compare/v3.6.10...v3.6.11
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- langchain4j-reactor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain4j-reactor/pom.xml b/langchain4j-reactor/pom.xml index 141aa5e8..d1d088dc 100644 --- a/langchain4j-reactor/pom.xml +++ b/langchain4j-reactor/pom.xml @@ -25,7 +25,7 @@ io.projectreactor reactor-core - 3.6.10 + 3.6.11 From 7e69d8f2c8c0a7ff9f05ddf529a6c20f19122334 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:05:28 +0100 Subject: [PATCH 10/25] Update dependency org.apache.maven.plugins:maven-source-plugin to v3.3.1 (#57) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [org.apache.maven.plugins:maven-source-plugin](https://maven.apache.org/plugins/) | `3.3.0` -> `3.3.1` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.apache.maven.plugins:maven-source-plugin/3.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.apache.maven.plugins:maven-source-plugin/3.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.apache.maven.plugins:maven-source-plugin/3.3.0/3.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.apache.maven.plugins:maven-source-plugin/3.3.0/3.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c23a9afb..19925d29 100644 --- a/pom.xml +++ b/pom.xml @@ -139,7 +139,7 @@ org.apache.maven.plugins maven-source-plugin - 3.3.0 + 3.3.1 attach-sources From eb524afc522c74a2ae3e618c2397773511ebe6c3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:05:56 +0100 Subject: [PATCH 11/25] Update dependency maven to v3.9.9 (#56) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [maven](https://maven.apache.org/) | `3.9.6` -> `3.9.9` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.apache.maven:apache-maven/3.9.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.apache.maven:apache-maven/3.9.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.apache.maven:apache-maven/3.9.6/3.9.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.apache.maven:apache-maven/3.9.6/3.9.9?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .mvn/wrapper/maven-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 346d645f..1a60da79 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar From 5168223e5de1e6ca01c9ee79cd1b7d1cf3b993bd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:46:24 +0100 Subject: [PATCH 12/25] Update dependency org.projectlombok:lombok to v1.18.34 (#59) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [org.projectlombok:lombok](https://projectlombok.org) ([source](https://redirect.github.com/projectlombok/lombok)) | `1.18.32` -> `1.18.34` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.projectlombok:lombok/1.18.34?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.projectlombok:lombok/1.18.34?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.projectlombok:lombok/1.18.32/1.18.34?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.projectlombok:lombok/1.18.32/1.18.34?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
projectlombok/lombok (org.projectlombok:lombok) ### [`v1.18.34`](https://redirect.github.com/projectlombok/lombok/compare/v1.18.32...v1.18.34) [Compare Source](https://redirect.github.com/projectlombok/lombok/compare/v1.18.32...v1.18.34)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 19925d29..c8b85791 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,7 @@ org.projectlombok lombok - 1.18.32 + 1.18.34 From 8c0345835aa7797d40d04dc10e524a17df6b2b33 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:46:42 +0100 Subject: [PATCH 13/25] Update dependency org.honton.chas:license-maven-plugin to v0.0.6 (#58) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | org.honton.chas:license-maven-plugin | `0.0.3` -> `0.0.6` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.honton.chas:license-maven-plugin/0.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.honton.chas:license-maven-plugin/0.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.honton.chas:license-maven-plugin/0.0.3/0.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.honton.chas:license-maven-plugin/0.0.3/0.0.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c8b85791..c303482e 100644 --- a/pom.xml +++ b/pom.xml @@ -267,7 +267,7 @@ org.honton.chas license-maven-plugin - 0.0.3 + 0.0.6 From 9189170978730d180b1c51bacc2c8ed724a431be Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:56:12 +0100 Subject: [PATCH 14/25] Update dependency org.testcontainers:testcontainers-bom to v1.20.3 (#60) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [org.testcontainers:testcontainers-bom](https://java.testcontainers.org) ([source](https://redirect.github.com/testcontainers/testcontainers-java)) | `1.20.1` -> `1.20.3` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.testcontainers:testcontainers-bom/1.20.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.testcontainers:testcontainers-bom/1.20.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.testcontainers:testcontainers-bom/1.20.1/1.20.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.testcontainers:testcontainers-bom/1.20.1/1.20.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
testcontainers/testcontainers-java (org.testcontainers:testcontainers-bom) ### [`v1.20.3`](https://redirect.github.com/testcontainers/testcontainers-java/releases/tag/1.20.3) [Compare Source](https://redirect.github.com/testcontainers/testcontainers-java/compare/1.20.2...1.20.3) ##### What's Changed - Pin OceanBase image ([#​9416](https://redirect.github.com/testcontainers/testcontainers-java/issues/9416)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Fix execution in windows runner ([#​9413](https://redirect.github.com/testcontainers/testcontainers-java/issues/9413)) [@​eddumelendez](https://redirect.github.com/eddumelendez) ##### 🚀 Features & Enhancements - Log exception on socket problems ([#​8055](https://redirect.github.com/testcontainers/testcontainers-java/issues/8055)) [@​ciis0](https://redirect.github.com/ciis0) - Add support for apachepulsar/pulsar-all image ([#​9448](https://redirect.github.com/testcontainers/testcontainers-java/issues/9448)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Introduce new property to configure pull.timeout ([#​9417](https://redirect.github.com/testcontainers/testcontainers-java/issues/9417)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Add r2dbc support for Clickhouse ([#​8434](https://redirect.github.com/testcontainers/testcontainers-java/issues/8434)) [@​livk-cloud](https://redirect.github.com/livk-cloud) - Support reset value in Docker Compose ([#​9343](https://redirect.github.com/testcontainers/testcontainers-java/issues/9343)) [@​eddumelendez](https://redirect.github.com/eddumelendez) ##### 🐛 Bug Fixes - fix: await during DockerClientProviderStrategy test method ([#​9412](https://redirect.github.com/testcontainers/testcontainers-java/issues/9412)) [@​KyleAure](https://redirect.github.com/KyleAure) - Parse docker compose file correctly when version is not declared ([#​9420](https://redirect.github.com/testcontainers/testcontainers-java/issues/9420)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Read docker credentials stdout and stderr independently ([#​8007](https://redirect.github.com/testcontainers/testcontainers-java/issues/8007)) [@​Smeb](https://redirect.github.com/Smeb) - Use server URL from auth query if helper does not return one ([#​9056](https://redirect.github.com/testcontainers/testcontainers-java/issues/9056)) [@​eager-signal](https://redirect.github.com/eager-signal) - Clear docker compose initialization ([#​9370](https://redirect.github.com/testcontainers/testcontainers-java/issues/9370)) [@​eddumelendez](https://redirect.github.com/eddumelendez) ##### 📖 Documentation - Add "integration-testing" topic ([#​9338](https://redirect.github.com/testcontainers/testcontainers-java/issues/9338)) [@​bsideup](https://redirect.github.com/bsideup) ##### 🧹 Housekeeping - Declarative R2DBC SPI implementation ([#​9447](https://redirect.github.com/testcontainers/testcontainers-java/issues/9447)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Fix windows test ([#​9409](https://redirect.github.com/testcontainers/testcontainers-java/issues/9409)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Add ComposeContainer test to junit-jupiter module ([#​9407](https://redirect.github.com/testcontainers/testcontainers-java/issues/9407)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Check docker compose version ([#​9342](https://redirect.github.com/testcontainers/testcontainers-java/issues/9342)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Use Awaitility in FixedHostPortContainerTest ([#​9341](https://redirect.github.com/testcontainers/testcontainers-java/issues/9341)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Polish Kafka examples ([#​9340](https://redirect.github.com/testcontainers/testcontainers-java/issues/9340)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Polish Cassandra tests ([#​9339](https://redirect.github.com/testcontainers/testcontainers-java/issues/9339)) [@​eddumelendez](https://redirect.github.com/eddumelendez) ### [`v1.20.2`](https://redirect.github.com/testcontainers/testcontainers-java/releases/tag/1.20.2) [Compare Source](https://redirect.github.com/testcontainers/testcontainers-java/compare/1.20.1...1.20.2) ##### What's Changed - Update ryuk version to 0.9.0 ([#​9169](https://redirect.github.com/testcontainers/testcontainers-java/issues/9169)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Add on-demand execution on windows ([#​9138](https://redirect.github.com/testcontainers/testcontainers-java/issues/9138)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Add workflow to test Docker Desktop for Windows ([#​9076](https://redirect.github.com/testcontainers/testcontainers-java/issues/9076)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Check if docker is available ([#​9069](https://redirect.github.com/testcontainers/testcontainers-java/issues/9069)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Check if docker-compose is available ([#​9060](https://redirect.github.com/testcontainers/testcontainers-java/issues/9060)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Log docker daemon labels ([#​9054](https://redirect.github.com/testcontainers/testcontainers-java/issues/9054)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Update testcontainers version to ${GITHUB_REF##\*/} ([#​9052](https://redirect.github.com/testcontainers/testcontainers-java/issues/9052)) [@​github-actions](https://redirect.github.com/github-actions) - Update docs version to ${GITHUB_REF##\*/} ([#​9051](https://redirect.github.com/testcontainers/testcontainers-java/issues/9051)) [@​github-actions](https://redirect.github.com/github-actions) ##### 🚀 Features & Enhancements - Add MongoDB Atlas implementation ([#​9290](https://redirect.github.com/testcontainers/testcontainers-java/issues/9290)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Fix register listeners in RedpandaContainer ([#​9247](https://redirect.github.com/testcontainers/testcontainers-java/issues/9247)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Add Databend module ([#​9148](https://redirect.github.com/testcontainers/testcontainers-java/issues/9148)) [@​hantmac](https://redirect.github.com/hantmac) - Support adding new listeners to Apache Kafka ([#​9142](https://redirect.github.com/testcontainers/testcontainers-java/issues/9142)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Add Timeplus module ([#​8779](https://redirect.github.com/testcontainers/testcontainers-java/issues/8779)) [@​lizhou1111](https://redirect.github.com/lizhou1111) - Add new CassandraContainer implementation ([#​8616](https://redirect.github.com/testcontainers/testcontainers-java/issues/8616)) [@​maximevw](https://redirect.github.com/maximevw) ##### 🐛 Bug Fixes - fix: no match for platform in manifest when containerd is enabled ([#​9200](https://redirect.github.com/testcontainers/testcontainers-java/issues/9200)) [@​monosoul](https://redirect.github.com/monosoul) - Do not use network aliases in KAFKA_CONTROLLER_QUORUM_VOTERS ([#​9144](https://redirect.github.com/testcontainers/testcontainers-java/issues/9144)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Fix missing null check for JDBC init script ([#​9118](https://redirect.github.com/testcontainers/testcontainers-java/issues/9118)) [@​mmorshedi](https://redirect.github.com/mmorshedi) - Set MariaDB user when is not root ([#​9077](https://redirect.github.com/testcontainers/testcontainers-java/issues/9077)) [@​eddumelendez](https://redirect.github.com/eddumelendez) ##### 📖 Documentation - Fix gcloud docs ([#​9246](https://redirect.github.com/testcontainers/testcontainers-java/issues/9246)) [@​jiakuan](https://redirect.github.com/jiakuan) - Add ConfluentKafkaContainer ([#​9139](https://redirect.github.com/testcontainers/testcontainers-java/issues/9139)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Improve GitLab docs ([#​8775](https://redirect.github.com/testcontainers/testcontainers-java/issues/8775)) [@​JapuDCret](https://redirect.github.com/JapuDCret) - \[docs] Update localstack version ([#​8515](https://redirect.github.com/testcontainers/testcontainers-java/issues/8515)) [@​sullis](https://redirect.github.com/sullis) - Improve docs for Elasticsearch 8 ([#​8870](https://redirect.github.com/testcontainers/testcontainers-java/issues/8870)) [@​philipp94831](https://redirect.github.com/philipp94831) ##### 🧹 Housekeeping - Update MSSQL images to execute in ubuntu-22.04 ([#​9254](https://redirect.github.com/testcontainers/testcontainers-java/issues/9254)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Update redis version to 5.1.3 ([#​9250](https://redirect.github.com/testcontainers/testcontainers-java/issues/9250)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Use awaitility in Kafka module ([#​9248](https://redirect.github.com/testcontainers/testcontainers-java/issues/9248)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Improve test logging in examples and smoke-test ([#​9145](https://redirect.github.com/testcontainers/testcontainers-java/issues/9145)) [@​eddumelendez](https://redirect.github.com/eddumelendez) ##### 📦 Dependency updates - Combined dependencies PR ([#​9286](https://redirect.github.com/testcontainers/testcontainers-java/issues/9286)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Combined dependencies PR ([#​9285](https://redirect.github.com/testcontainers/testcontainers-java/issues/9285)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Combined dependencies PR ([#​9284](https://redirect.github.com/testcontainers/testcontainers-java/issues/9284)) [@​eddumelendez](https://redirect.github.com/eddumelendez) - Update redis version to 5.1.3 ([#​9250](https://redirect.github.com/testcontainers/testcontainers-java/issues/9250)) [@​eddumelendez](https://redirect.github.com/eddumelendez)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c303482e..ad3640ed 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ UTF-8 2.6.2 3.2.6 - 1.20.1 + 1.20.3 2.6.2 From f46b9ebf9e8f923d3ab5766e294f28c32cffd5a4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:56:47 +0100 Subject: [PATCH 15/25] Update dependency maven-wrapper to v3.3.2 (#61) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [maven-wrapper](https://maven.apache.org/) | `3.2.0` -> `3.3.2` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.apache.maven.wrapper:maven-wrapper/3.3.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.apache.maven.wrapper:maven-wrapper/3.3.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.apache.maven.wrapper:maven-wrapper/3.2.0/3.3.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.apache.maven.wrapper:maven-wrapper/3.2.0/3.3.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .mvn/wrapper/maven-wrapper.properties | 3 +- mvnw | 435 ++++++++++++-------------- mvnw.cmd | 354 +++++++++------------ 3 files changed, 344 insertions(+), 448 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 1a60da79..d58dfb70 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -14,5 +14,6 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +wrapperVersion=3.3.2 +distributionType=only-script distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/mvnw b/mvnw index 8d937f4c..19529ddf 100755 --- a/mvnw +++ b/mvnw @@ -19,290 +19,241 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Apache Maven Wrapper startup batch script, version 3.2.0 -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir +# Apache Maven Wrapper startup batch script, version 3.3.2 # # Optional ENV vars # ----------------- -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output # ---------------------------------------------------------------------------- -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /usr/local/etc/mavenrc ] ; then - . /usr/local/etc/mavenrc - fi - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false +# OS specific support. +native_path() { printf %s\\n "$1"; } case "$(uname)" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME - else - JAVA_HOME="/Library/Java/Home"; export JAVA_HOME - fi - fi - ;; +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; esac -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=$(java-config --jre-home) - fi -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$JAVA_HOME" ] && - JAVA_HOME=$(cygpath --unix "$JAVA_HOME") - [ -n "$CLASSPATH" ] && - CLASSPATH=$(cygpath --path --unix "$CLASSPATH") -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && - JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="$(which javac)" - if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=$(which readlink) - if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then - if $darwin ; then - javaHome="$(dirname "\"$javaExecutable\"")" - javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" - else - javaExecutable="$(readlink -f "\"$javaExecutable\"")" - fi - javaHome="$(dirname "\"$javaExecutable\"")" - javaHome=$(expr "$javaHome" : '\(.*\)/bin') - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" else JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi fi else - JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi fi +} - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=$(cd "$wdir/.." || exit 1; pwd) - fi - # end of workaround +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" done - printf '%s' "$(cd "$basedir" || exit 1; pwd)" + printf %x\\n $h } -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - # Remove \r in case we run on Windows within Git Bash - # and check out the repository with auto CRLF management - # enabled. Otherwise, we may read lines that are delimited with - # \r\n and produce $'-Xarg\r' rather than -Xarg due to word - # splitting rules. - tr -s '\r\n' ' ' < "$1" - fi +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 } -log() { - if [ "$MVNW_VERBOSE" = true ]; then - printf '%s\n' "$1" - fi +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" } -BASE_DIR=$(find_maven_basedir "$(dirname "$0")") -if [ -z "$BASE_DIR" ]; then - exit 1; +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" fi -MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR -log "$MAVEN_PROJECTBASEDIR" +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" -if [ -r "$wrapperJarPath" ]; then - log "Found $wrapperJarPath" +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT else - log "Couldn't find $wrapperJarPath, downloading it ..." + die "cannot create temp dir" +fi - if [ -n "$MVNW_REPOURL" ]; then - wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - else - wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - fi - while IFS="=" read -r key value; do - # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) - safeValue=$(echo "$value" | tr -d '\r') - case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; - esac - done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" - log "Downloading from: $wrapperUrl" +mkdir -p -- "${MAVEN_HOME%/*}" - if $cygwin; then - wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") - fi +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" - if command -v wget > /dev/null; then - log "Found wget ... using wget" - [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" - else - wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - log "Found curl ... using curl" - [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" - else - curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" - fi - else - log "Falling back to using Java to download" - javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" - javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaSource=$(cygpath --path --windows "$javaSource") - javaClass=$(cygpath --path --windows "$javaClass") - fi - if [ -e "$javaSource" ]; then - if [ ! -e "$javaClass" ]; then - log " - Compiling MavenWrapperDownloader.java ..." - ("$JAVA_HOME/bin/javac" "$javaSource") - fi - if [ -e "$javaClass" ]; then - log " - Running MavenWrapperDownloader.java ..." - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" - fi - fi - fi +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" fi -########################################################################################## -# End of extension -########################################################################################## -# If specified, validate the SHA-256 sum of the Maven wrapper jar file -wrapperSha256Sum="" -while IFS="=" read -r key value; do - case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; - esac -done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" -if [ -n "$wrapperSha256Sum" ]; then - wrapperSha256Result=false - if command -v sha256sum > /dev/null; then - if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then - wrapperSha256Result=true +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then + distributionSha256Result=true fi - elif command -v shasum > /dev/null; then - if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then - wrapperSha256Result=true + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true fi else - echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." - echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 exit 1 fi - if [ $wrapperSha256Result = false ]; then - echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 - echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 - echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 exit 1 fi fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$JAVA_HOME" ] && - JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") - [ -n "$CLASSPATH" ] && - CLASSPATH=$(cygpath --path --windows "$CLASSPATH") - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" fi +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -# shellcheck disable=SC2086 # safe args -exec "$JAVACMD" \ - $MAVEN_OPTS \ - $MAVEN_DEBUG_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd index c4586b56..b150b91e 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -1,205 +1,149 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Apache Maven Wrapper startup batch script, version 3.2.0 -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* -if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %WRAPPER_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file -SET WRAPPER_SHA_256_SUM="" -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B -) -IF NOT %WRAPPER_SHA_256_SUM%=="" ( - powershell -Command "&{"^ - "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ - "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ - " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ - " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ - " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ - " exit 1;"^ - "}"^ - "}" - if ERRORLEVEL 1 goto error -) - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% ^ - %JVM_CONFIG_MAVEN_PROPS% ^ - %MAVEN_OPTS% ^ - %MAVEN_DEBUG_OPTS% ^ - -classpath %WRAPPER_JAR% ^ - "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ - %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" -if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause - -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% - -cmd /C exit /B %ERROR_CODE% +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.2 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' +$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" +if ($env:MAVEN_USER_HOME) { + $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" +} +$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" From a6c0d82f60e65c070a51a4b1ba25f6ce1a556524 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:26:33 +0100 Subject: [PATCH 16/25] Update dependency org.sonatype.plugins:nexus-staging-maven-plugin to v1.7.0 (#70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [org.sonatype.plugins:nexus-staging-maven-plugin](http://www.sonatype.com/) ([source](https://redirect.github.com/sonatype/nexus-maven-plugins)) | `1.6.13` -> `1.7.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.sonatype.plugins:nexus-staging-maven-plugin/1.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.sonatype.plugins:nexus-staging-maven-plugin/1.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.sonatype.plugins:nexus-staging-maven-plugin/1.6.13/1.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.sonatype.plugins:nexus-staging-maven-plugin/1.6.13/1.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sonatype/nexus-maven-plugins (org.sonatype.plugins:nexus-staging-maven-plugin) ### [`v1.7.0`](https://redirect.github.com/sonatype/nexus-maven-plugins/compare/release-1.6.14...release-1.7.0) [Compare Source](https://redirect.github.com/sonatype/nexus-maven-plugins/compare/release-1.6.14...release-1.7.0) ### [`v1.6.14`](https://redirect.github.com/sonatype/nexus-maven-plugins/compare/release-1.6.13...release-1.6.14) [Compare Source](https://redirect.github.com/sonatype/nexus-maven-plugins/compare/release-1.6.13...release-1.6.14)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ad3640ed..4f814dc9 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.13 + 1.7.0 true ossrh From 37dd9c771a232e2f2e01f5bf7ac2e33f93ddd704 Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Wed, 13 Nov 2024 08:38:10 +0100 Subject: [PATCH 17/25] Add support for GitHub Modules (#43) --- .github/workflows/main.yaml | 1 + .github/workflows/release.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b14f15ed..b5c2555c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -33,6 +33,7 @@ jobs: AZURE_OPENAI_KEY: ${{ secrets.AZURE_OPENAI_KEY }} AZURE_SEARCH_ENDPOINT: ${{ secrets.AZURE_SEARCH_ENDPOINT }} AZURE_SEARCH_KEY: ${{ secrets.AZURE_SEARCH_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c8cab5e3..13dc7f1e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -32,6 +32,7 @@ jobs: AZURE_OPENAI_KEY: ${{ secrets.AZURE_OPENAI_KEY }} AZURE_SEARCH_ENDPOINT: ${{ secrets.AZURE_SEARCH_ENDPOINT }} AZURE_SEARCH_KEY: ${{ secrets.AZURE_SEARCH_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} VOYAGE_API_KEY: ${{ secrets.VOYAGE_API_KEY }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} From d56976c111648c5caae07d78cafca76add675b85 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:41:10 +0100 Subject: [PATCH 18/25] Update tinylog.version to v2.7.0 (#72) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [org.tinylog:slf4j-tinylog](https://tinylog.org/) ([source](https://redirect.github.com/tinylog-org/tinylog)) | `2.6.2` -> `2.7.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.tinylog:slf4j-tinylog/2.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.tinylog:slf4j-tinylog/2.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.tinylog:slf4j-tinylog/2.6.2/2.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.tinylog:slf4j-tinylog/2.6.2/2.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [org.tinylog:tinylog-impl](https://tinylog.org/) ([source](https://redirect.github.com/tinylog-org/tinylog)) | `2.6.2` -> `2.7.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.tinylog:tinylog-impl/2.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.tinylog:tinylog-impl/2.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.tinylog:tinylog-impl/2.6.2/2.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.tinylog:tinylog-impl/2.6.2/2.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
tinylog-org/tinylog (org.tinylog:slf4j-tinylog) ### [`v2.7.0`](https://redirect.github.com/tinylog-org/tinylog/releases/tag/2.7.0): Version 2.7.0 [Compare Source](https://redirect.github.com/tinylog-org/tinylog/compare/2.6.2...2.7.0) The final release version 2.7.0 contains the same set of features as tinylog 2.7.0-M3 as no bugs were found.
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4f814dc9..81e1e65e 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ 2.6.2 3.2.6 1.20.3 - 2.6.2 + 2.7.0 From 9217a57c9a0986db4b287d35ca9a3d3b8c20dfee Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:41:35 +0100 Subject: [PATCH 19/25] Update dependency org.junit.jupiter:junit-jupiter-engine to v5.11.3 (#69) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [org.junit.jupiter:junit-jupiter-engine](https://junit.org/junit5/) ([source](https://redirect.github.com/junit-team/junit5)) | `5.10.0` -> `5.11.3` | [![age](https://developer.mend.io/api/mc/badges/age/maven/org.junit.jupiter:junit-jupiter-engine/5.11.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/org.junit.jupiter:junit-jupiter-engine/5.11.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/org.junit.jupiter:junit-jupiter-engine/5.10.0/5.11.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/org.junit.jupiter:junit-jupiter-engine/5.10.0/5.11.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- langchain4j-reactor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain4j-reactor/pom.xml b/langchain4j-reactor/pom.xml index d1d088dc..5828fa21 100644 --- a/langchain4j-reactor/pom.xml +++ b/langchain4j-reactor/pom.xml @@ -40,7 +40,7 @@ org.junit.jupiter junit-jupiter-engine - 5.10.0 + 5.11.3 test From a4d4b3738fcfad9f1de86e0a106d8a82304280cd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:41:55 +0100 Subject: [PATCH 20/25] Update dependency io.projectreactor:reactor-test to v3.7.0 (#68) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [io.projectreactor:reactor-test](https://redirect.github.com/reactor/reactor-core) | `3.6.11` -> `3.7.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/io.projectreactor:reactor-test/3.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.projectreactor:reactor-test/3.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.projectreactor:reactor-test/3.6.11/3.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.projectreactor:reactor-test/3.6.11/3.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
reactor/reactor-core (io.projectreactor:reactor-test) ### [`v3.7.0`](https://redirect.github.com/reactor/reactor-core/compare/v3.6.12...v3.7.0) [Compare Source](https://redirect.github.com/reactor/reactor-core/compare/v3.6.12...v3.7.0) ### [`v3.6.12`](https://redirect.github.com/reactor/reactor-core/compare/v3.6.11...v3.6.12) [Compare Source](https://redirect.github.com/reactor/reactor-core/compare/v3.6.11...v3.6.12)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/langchain4j/langchain4j-spring). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- langchain4j-reactor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain4j-reactor/pom.xml b/langchain4j-reactor/pom.xml index 5828fa21..9f42657e 100644 --- a/langchain4j-reactor/pom.xml +++ b/langchain4j-reactor/pom.xml @@ -33,7 +33,7 @@ io.projectreactor reactor-test - 3.6.11 + 3.7.0 test From f00df98148ed6f1f17e0b38c276674981d3917f5 Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Wed, 13 Nov 2024 15:49:00 +0100 Subject: [PATCH 21/25] Release 0.36.0 (#73) --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- langchain4j-anthropic-spring-boot-starter/pom.xml | 2 +- langchain4j-azure-ai-search-spring-boot-starter/pom.xml | 2 +- langchain4j-azure-open-ai-spring-boot-starter/pom.xml | 2 +- langchain4j-dashscope-spring-boot-starter/pom.xml | 2 +- langchain4j-easy-rag-spring-boot-starter/pom.xml | 2 +- langchain4j-elasticsearch-spring-boot-starter/pom.xml | 2 +- langchain4j-github-models-spring-boot-starter/pom.xml | 2 +- langchain4j-milvus-spring-boot-starter/pom.xml | 2 +- langchain4j-ollama-spring-boot-starter/pom.xml | 2 +- langchain4j-open-ai-spring-boot-starter/pom.xml | 2 +- langchain4j-qianfan-spring-boot-starter/pom.xml | 2 +- langchain4j-reactor/pom.xml | 2 +- langchain4j-redis-spring-boot-starter/pom.xml | 2 +- langchain4j-spring-boot-starter/pom.xml | 2 +- langchain4j-spring-boot-tests/pom.xml | 2 +- langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml | 2 +- langchain4j-voyage-ai-spring-boot-starter/pom.xml | 2 +- pom.xml | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6fbd1bb0..4d3b861b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,7 +23,7 @@ Please provide a relevant code snippets to reproduce this bug. A clear and concise description of what you expected to happen. **Please complete the following information:** -- LangChain4j version: e.g. 0.35.0 +- LangChain4j version: e.g. 0.36.0 - Java version: e.g. 17 - Spring Boot version: e.g. 3.3.1 diff --git a/langchain4j-anthropic-spring-boot-starter/pom.xml b/langchain4j-anthropic-spring-boot-starter/pom.xml index 12b3e3bd..6751422e 100644 --- a/langchain4j-anthropic-spring-boot-starter/pom.xml +++ b/langchain4j-anthropic-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-azure-ai-search-spring-boot-starter/pom.xml b/langchain4j-azure-ai-search-spring-boot-starter/pom.xml index 5168b8fe..5d5b8ee4 100644 --- a/langchain4j-azure-ai-search-spring-boot-starter/pom.xml +++ b/langchain4j-azure-ai-search-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml index f642244a..7ee0a47b 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-dashscope-spring-boot-starter/pom.xml b/langchain4j-dashscope-spring-boot-starter/pom.xml index 594fc006..64a51165 100644 --- a/langchain4j-dashscope-spring-boot-starter/pom.xml +++ b/langchain4j-dashscope-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-easy-rag-spring-boot-starter/pom.xml b/langchain4j-easy-rag-spring-boot-starter/pom.xml index 1ad25135..bb9c937c 100644 --- a/langchain4j-easy-rag-spring-boot-starter/pom.xml +++ b/langchain4j-easy-rag-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-elasticsearch-spring-boot-starter/pom.xml b/langchain4j-elasticsearch-spring-boot-starter/pom.xml index b153a6f9..619717e5 100644 --- a/langchain4j-elasticsearch-spring-boot-starter/pom.xml +++ b/langchain4j-elasticsearch-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-github-models-spring-boot-starter/pom.xml b/langchain4j-github-models-spring-boot-starter/pom.xml index b9e951c4..2aa61a71 100644 --- a/langchain4j-github-models-spring-boot-starter/pom.xml +++ b/langchain4j-github-models-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-milvus-spring-boot-starter/pom.xml b/langchain4j-milvus-spring-boot-starter/pom.xml index a1279fcd..88c3388f 100644 --- a/langchain4j-milvus-spring-boot-starter/pom.xml +++ b/langchain4j-milvus-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-ollama-spring-boot-starter/pom.xml b/langchain4j-ollama-spring-boot-starter/pom.xml index 058f6d96..4ce6f91a 100644 --- a/langchain4j-ollama-spring-boot-starter/pom.xml +++ b/langchain4j-ollama-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-open-ai-spring-boot-starter/pom.xml b/langchain4j-open-ai-spring-boot-starter/pom.xml index a680136c..3e03f347 100644 --- a/langchain4j-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-open-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-qianfan-spring-boot-starter/pom.xml b/langchain4j-qianfan-spring-boot-starter/pom.xml index 4ce74795..5d3b73dc 100644 --- a/langchain4j-qianfan-spring-boot-starter/pom.xml +++ b/langchain4j-qianfan-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-reactor/pom.xml b/langchain4j-reactor/pom.xml index 9f42657e..252dc7b1 100644 --- a/langchain4j-reactor/pom.xml +++ b/langchain4j-reactor/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-redis-spring-boot-starter/pom.xml b/langchain4j-redis-spring-boot-starter/pom.xml index 41fec689..8ee4b77a 100644 --- a/langchain4j-redis-spring-boot-starter/pom.xml +++ b/langchain4j-redis-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-spring-boot-starter/pom.xml b/langchain4j-spring-boot-starter/pom.xml index 3d7fe46a..55f8b021 100644 --- a/langchain4j-spring-boot-starter/pom.xml +++ b/langchain4j-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-spring-boot-tests/pom.xml b/langchain4j-spring-boot-tests/pom.xml index d6f73eb2..ad2738eb 100644 --- a/langchain4j-spring-boot-tests/pom.xml +++ b/langchain4j-spring-boot-tests/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml b/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml index 8d98fa6c..677c4fbd 100644 --- a/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml +++ b/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/langchain4j-voyage-ai-spring-boot-starter/pom.xml b/langchain4j-voyage-ai-spring-boot-starter/pom.xml index 89e0c1a2..ffa594d0 100644 --- a/langchain4j-voyage-ai-spring-boot-starter/pom.xml +++ b/langchain4j-voyage-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 ../pom.xml diff --git a/pom.xml b/pom.xml index 81e1e65e..3c8b6c40 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0-SNAPSHOT + 0.36.0 pom langchain4j-spring parent POM From 1cf87b8c7319a9b0c9e9dce1f96adb95ac5112f0 Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Wed, 13 Nov 2024 17:17:36 +0100 Subject: [PATCH 22/25] change version to 0.37.0-SNAPSHOT --- langchain4j-anthropic-spring-boot-starter/pom.xml | 2 +- langchain4j-azure-ai-search-spring-boot-starter/pom.xml | 2 +- langchain4j-azure-open-ai-spring-boot-starter/pom.xml | 2 +- langchain4j-dashscope-spring-boot-starter/pom.xml | 2 +- langchain4j-easy-rag-spring-boot-starter/pom.xml | 2 +- langchain4j-elasticsearch-spring-boot-starter/pom.xml | 2 +- langchain4j-github-models-spring-boot-starter/pom.xml | 2 +- langchain4j-milvus-spring-boot-starter/pom.xml | 2 +- langchain4j-ollama-spring-boot-starter/pom.xml | 2 +- langchain4j-open-ai-spring-boot-starter/pom.xml | 2 +- langchain4j-qianfan-spring-boot-starter/pom.xml | 2 +- langchain4j-reactor/pom.xml | 2 +- langchain4j-redis-spring-boot-starter/pom.xml | 2 +- langchain4j-spring-boot-starter/pom.xml | 2 +- langchain4j-spring-boot-tests/pom.xml | 2 +- langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml | 2 +- langchain4j-voyage-ai-spring-boot-starter/pom.xml | 2 +- pom.xml | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/langchain4j-anthropic-spring-boot-starter/pom.xml b/langchain4j-anthropic-spring-boot-starter/pom.xml index 6751422e..6b747eb7 100644 --- a/langchain4j-anthropic-spring-boot-starter/pom.xml +++ b/langchain4j-anthropic-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-azure-ai-search-spring-boot-starter/pom.xml b/langchain4j-azure-ai-search-spring-boot-starter/pom.xml index 5d5b8ee4..335fb700 100644 --- a/langchain4j-azure-ai-search-spring-boot-starter/pom.xml +++ b/langchain4j-azure-ai-search-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml index 7ee0a47b..1a87fd3e 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-dashscope-spring-boot-starter/pom.xml b/langchain4j-dashscope-spring-boot-starter/pom.xml index 64a51165..5af252dc 100644 --- a/langchain4j-dashscope-spring-boot-starter/pom.xml +++ b/langchain4j-dashscope-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-easy-rag-spring-boot-starter/pom.xml b/langchain4j-easy-rag-spring-boot-starter/pom.xml index bb9c937c..7701b0af 100644 --- a/langchain4j-easy-rag-spring-boot-starter/pom.xml +++ b/langchain4j-easy-rag-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-elasticsearch-spring-boot-starter/pom.xml b/langchain4j-elasticsearch-spring-boot-starter/pom.xml index 619717e5..ac2c2d4c 100644 --- a/langchain4j-elasticsearch-spring-boot-starter/pom.xml +++ b/langchain4j-elasticsearch-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-github-models-spring-boot-starter/pom.xml b/langchain4j-github-models-spring-boot-starter/pom.xml index 2aa61a71..4372fbfc 100644 --- a/langchain4j-github-models-spring-boot-starter/pom.xml +++ b/langchain4j-github-models-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-milvus-spring-boot-starter/pom.xml b/langchain4j-milvus-spring-boot-starter/pom.xml index 88c3388f..1d219666 100644 --- a/langchain4j-milvus-spring-boot-starter/pom.xml +++ b/langchain4j-milvus-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-ollama-spring-boot-starter/pom.xml b/langchain4j-ollama-spring-boot-starter/pom.xml index 4ce6f91a..eecb11b5 100644 --- a/langchain4j-ollama-spring-boot-starter/pom.xml +++ b/langchain4j-ollama-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-open-ai-spring-boot-starter/pom.xml b/langchain4j-open-ai-spring-boot-starter/pom.xml index 3e03f347..6bf9d25d 100644 --- a/langchain4j-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-open-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-qianfan-spring-boot-starter/pom.xml b/langchain4j-qianfan-spring-boot-starter/pom.xml index 5d3b73dc..36fedf04 100644 --- a/langchain4j-qianfan-spring-boot-starter/pom.xml +++ b/langchain4j-qianfan-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-reactor/pom.xml b/langchain4j-reactor/pom.xml index 252dc7b1..ffc80663 100644 --- a/langchain4j-reactor/pom.xml +++ b/langchain4j-reactor/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-redis-spring-boot-starter/pom.xml b/langchain4j-redis-spring-boot-starter/pom.xml index 8ee4b77a..0701efd6 100644 --- a/langchain4j-redis-spring-boot-starter/pom.xml +++ b/langchain4j-redis-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-spring-boot-starter/pom.xml b/langchain4j-spring-boot-starter/pom.xml index 55f8b021..30440842 100644 --- a/langchain4j-spring-boot-starter/pom.xml +++ b/langchain4j-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-spring-boot-tests/pom.xml b/langchain4j-spring-boot-tests/pom.xml index ad2738eb..8da75976 100644 --- a/langchain4j-spring-boot-tests/pom.xml +++ b/langchain4j-spring-boot-tests/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml b/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml index 677c4fbd..037da213 100644 --- a/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml +++ b/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-voyage-ai-spring-boot-starter/pom.xml b/langchain4j-voyage-ai-spring-boot-starter/pom.xml index ffa594d0..1d9970ad 100644 --- a/langchain4j-voyage-ai-spring-boot-starter/pom.xml +++ b/langchain4j-voyage-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 3c8b6c40..b87d59d2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.0 + 0.37.0-SNAPSHOT pom langchain4j-spring parent POM From c6c183b1d18b6e9e6b88b9443aca3eab6c108a3c Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Thu, 14 Nov 2024 09:36:23 +0100 Subject: [PATCH 23/25] added test for explicit tool wiring --- .../tools/AiServiceWithExplicitTools.java | 11 ++++++ ...AiServiceWithExplicitToolsApplication.java | 12 +++++++ .../tools/AiServiceWithExplicitToolsIT.java | 36 +++++++++++++++++++ .../spring/mode/explicit/tools/Tools1.java | 15 ++++++++ .../spring/mode/explicit/tools/Tools2.java | 15 ++++++++ 5 files changed, 89 insertions(+) create mode 100644 langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitTools.java create mode 100644 langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitToolsApplication.java create mode 100644 langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitToolsIT.java create mode 100644 langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/Tools1.java create mode 100644 langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/Tools2.java diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitTools.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitTools.java new file mode 100644 index 00000000..d9e17802 --- /dev/null +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitTools.java @@ -0,0 +1,11 @@ +package dev.langchain4j.service.spring.mode.explicit.tools; + +import dev.langchain4j.service.spring.AiService; + +import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT; + +@AiService(wiringMode = EXPLICIT, chatModel = "openAiChatModel", tools = {"tools1"}) +public interface AiServiceWithExplicitTools { + + String chat(String userMessage); +} diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitToolsApplication.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitToolsApplication.java new file mode 100644 index 00000000..5905e85a --- /dev/null +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitToolsApplication.java @@ -0,0 +1,12 @@ +package dev.langchain4j.service.spring.mode.explicit.tools; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +class AiServiceWithExplicitToolsApplication { + + public static void main(String[] args) { + SpringApplication.run(AiServiceWithExplicitToolsApplication.class, args); + } +} diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitToolsIT.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitToolsIT.java new file mode 100644 index 00000000..c2e987df --- /dev/null +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/AiServiceWithExplicitToolsIT.java @@ -0,0 +1,36 @@ +package dev.langchain4j.service.spring.mode.explicit.tools; + +import dev.langchain4j.service.spring.AiServicesAutoConfig; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; + +import static dev.langchain4j.service.spring.mode.explicit.tools.Tools1.TOOL_1_TEMPERATURE; +import static dev.langchain4j.service.spring.mode.explicit.tools.Tools2.TOOL_2_TEMPERATURE; +import static org.assertj.core.api.Assertions.assertThat; + +class AiServiceWithExplicitToolsIT { + + ApplicationContextRunner contextRunner = new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(AiServicesAutoConfig.class)); + + @Test + void should_create_AI_service_with_explicit_tools() { + contextRunner + .withPropertyValues( + "langchain4j.open-ai.chat-model.api-key=" + System.getenv("OPENAI_API_KEY"), + "langchain4j.open-ai.chat-model.max-tokens=100", + "langchain4j.open-ai.chat-model.temperature=0.0") + .withUserConfiguration(AiServiceWithExplicitToolsApplication.class) + .run(context -> { + + // given + AiServiceWithExplicitTools aiService = context.getBean(AiServiceWithExplicitTools.class); + + // when + String answer = aiService.chat("What is the temperature?"); + + // then + assertThat(answer).contains(TOOL_1_TEMPERATURE).doesNotContain(TOOL_2_TEMPERATURE); + }); + } +} \ No newline at end of file diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/Tools1.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/Tools1.java new file mode 100644 index 00000000..21667338 --- /dev/null +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/Tools1.java @@ -0,0 +1,15 @@ +package dev.langchain4j.service.spring.mode.explicit.tools; + +import dev.langchain4j.agent.tool.Tool; +import org.springframework.stereotype.Component; + +@Component +class Tools1 { + + public static final String TOOL_1_TEMPERATURE = "6"; + + @Tool + String getCurrentTemperature() { + return TOOL_1_TEMPERATURE; + } +} diff --git a/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/Tools2.java b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/Tools2.java new file mode 100644 index 00000000..310848d6 --- /dev/null +++ b/langchain4j-spring-boot-starter/src/test/java/dev/langchain4j/service/spring/mode/explicit/tools/Tools2.java @@ -0,0 +1,15 @@ +package dev.langchain4j.service.spring.mode.explicit.tools; + +import dev.langchain4j.agent.tool.Tool; +import org.springframework.stereotype.Component; + +@Component +class Tools2 { + + public static final String TOOL_2_TEMPERATURE = "9"; + + @Tool + String getCurrentTemperature() { + return TOOL_2_TEMPERATURE; + } +} From 1c0f27d0d97eb100ff73542152e37fcf744723f8 Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Tue, 19 Nov 2024 16:22:08 +0100 Subject: [PATCH 24/25] Release 0.36.1 (#78) --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- langchain4j-anthropic-spring-boot-starter/pom.xml | 2 +- .../pom.xml | 2 +- langchain4j-azure-open-ai-spring-boot-starter/pom.xml | 2 +- langchain4j-dashscope-spring-boot-starter/pom.xml | 2 +- langchain4j-easy-rag-spring-boot-starter/pom.xml | 2 +- langchain4j-elasticsearch-spring-boot-starter/pom.xml | 10 +++++++++- langchain4j-github-models-spring-boot-starter/pom.xml | 2 +- langchain4j-milvus-spring-boot-starter/pom.xml | 2 +- langchain4j-ollama-spring-boot-starter/pom.xml | 2 +- langchain4j-open-ai-spring-boot-starter/pom.xml | 2 +- langchain4j-qianfan-spring-boot-starter/pom.xml | 2 +- langchain4j-reactor/pom.xml | 2 +- langchain4j-redis-spring-boot-starter/pom.xml | 2 +- langchain4j-spring-boot-starter/pom.xml | 2 +- langchain4j-spring-boot-tests/pom.xml | 2 +- .../pom.xml | 2 +- langchain4j-voyage-ai-spring-boot-starter/pom.xml | 2 +- pom.xml | 2 +- 19 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4d3b861b..699f39fd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,7 +23,7 @@ Please provide a relevant code snippets to reproduce this bug. A clear and concise description of what you expected to happen. **Please complete the following information:** -- LangChain4j version: e.g. 0.36.0 +- LangChain4j version: e.g. 0.36.1 - Java version: e.g. 17 - Spring Boot version: e.g. 3.3.1 diff --git a/langchain4j-anthropic-spring-boot-starter/pom.xml b/langchain4j-anthropic-spring-boot-starter/pom.xml index 6b747eb7..2c00be36 100644 --- a/langchain4j-anthropic-spring-boot-starter/pom.xml +++ b/langchain4j-anthropic-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-azure-ai-search-spring-boot-starter/pom.xml b/langchain4j-azure-ai-search-spring-boot-starter/pom.xml index 335fb700..7cfd09cd 100644 --- a/langchain4j-azure-ai-search-spring-boot-starter/pom.xml +++ b/langchain4j-azure-ai-search-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml index 1a87fd3e..cee91070 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-dashscope-spring-boot-starter/pom.xml b/langchain4j-dashscope-spring-boot-starter/pom.xml index 5af252dc..fc92a946 100644 --- a/langchain4j-dashscope-spring-boot-starter/pom.xml +++ b/langchain4j-dashscope-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-easy-rag-spring-boot-starter/pom.xml b/langchain4j-easy-rag-spring-boot-starter/pom.xml index 7701b0af..a804ff7b 100644 --- a/langchain4j-easy-rag-spring-boot-starter/pom.xml +++ b/langchain4j-easy-rag-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-elasticsearch-spring-boot-starter/pom.xml b/langchain4j-elasticsearch-spring-boot-starter/pom.xml index ac2c2d4c..d0955fd0 100644 --- a/langchain4j-elasticsearch-spring-boot-starter/pom.xml +++ b/langchain4j-elasticsearch-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml @@ -104,6 +104,14 @@ slf4j-tinylog test
+ + + commons-io + commons-io + 2.17.0 + test + + diff --git a/langchain4j-github-models-spring-boot-starter/pom.xml b/langchain4j-github-models-spring-boot-starter/pom.xml index 4372fbfc..70e0c2ac 100644 --- a/langchain4j-github-models-spring-boot-starter/pom.xml +++ b/langchain4j-github-models-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-milvus-spring-boot-starter/pom.xml b/langchain4j-milvus-spring-boot-starter/pom.xml index 1d219666..272161e4 100644 --- a/langchain4j-milvus-spring-boot-starter/pom.xml +++ b/langchain4j-milvus-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-ollama-spring-boot-starter/pom.xml b/langchain4j-ollama-spring-boot-starter/pom.xml index eecb11b5..f3505069 100644 --- a/langchain4j-ollama-spring-boot-starter/pom.xml +++ b/langchain4j-ollama-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-open-ai-spring-boot-starter/pom.xml b/langchain4j-open-ai-spring-boot-starter/pom.xml index 6bf9d25d..9d44173a 100644 --- a/langchain4j-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-open-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-qianfan-spring-boot-starter/pom.xml b/langchain4j-qianfan-spring-boot-starter/pom.xml index 36fedf04..e9ac2ef3 100644 --- a/langchain4j-qianfan-spring-boot-starter/pom.xml +++ b/langchain4j-qianfan-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-reactor/pom.xml b/langchain4j-reactor/pom.xml index ffc80663..6a966e65 100644 --- a/langchain4j-reactor/pom.xml +++ b/langchain4j-reactor/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-redis-spring-boot-starter/pom.xml b/langchain4j-redis-spring-boot-starter/pom.xml index 0701efd6..583c8cd3 100644 --- a/langchain4j-redis-spring-boot-starter/pom.xml +++ b/langchain4j-redis-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-spring-boot-starter/pom.xml b/langchain4j-spring-boot-starter/pom.xml index 30440842..29a5d49c 100644 --- a/langchain4j-spring-boot-starter/pom.xml +++ b/langchain4j-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-spring-boot-tests/pom.xml b/langchain4j-spring-boot-tests/pom.xml index 8da75976..d8ab8aab 100644 --- a/langchain4j-spring-boot-tests/pom.xml +++ b/langchain4j-spring-boot-tests/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml b/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml index 037da213..967733d1 100644 --- a/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml +++ b/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/langchain4j-voyage-ai-spring-boot-starter/pom.xml b/langchain4j-voyage-ai-spring-boot-starter/pom.xml index 1d9970ad..e1bf6e5a 100644 --- a/langchain4j-voyage-ai-spring-boot-starter/pom.xml +++ b/langchain4j-voyage-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 ../pom.xml diff --git a/pom.xml b/pom.xml index b87d59d2..dd76f317 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.37.0-SNAPSHOT + 0.36.1 pom langchain4j-spring parent POM From 405fddafbcf8c3463c7211dc82b7c5887f9531c6 Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Tue, 19 Nov 2024 16:55:01 +0100 Subject: [PATCH 25/25] changed version to 0.37.0-SNAPSHOT --- langchain4j-anthropic-spring-boot-starter/pom.xml | 2 +- langchain4j-azure-ai-search-spring-boot-starter/pom.xml | 2 +- langchain4j-azure-open-ai-spring-boot-starter/pom.xml | 2 +- langchain4j-dashscope-spring-boot-starter/pom.xml | 2 +- langchain4j-easy-rag-spring-boot-starter/pom.xml | 2 +- langchain4j-elasticsearch-spring-boot-starter/pom.xml | 2 +- langchain4j-github-models-spring-boot-starter/pom.xml | 2 +- langchain4j-milvus-spring-boot-starter/pom.xml | 2 +- langchain4j-ollama-spring-boot-starter/pom.xml | 2 +- langchain4j-open-ai-spring-boot-starter/pom.xml | 2 +- langchain4j-qianfan-spring-boot-starter/pom.xml | 2 +- langchain4j-reactor/pom.xml | 2 +- langchain4j-redis-spring-boot-starter/pom.xml | 2 +- langchain4j-spring-boot-starter/pom.xml | 2 +- langchain4j-spring-boot-tests/pom.xml | 2 +- langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml | 2 +- langchain4j-voyage-ai-spring-boot-starter/pom.xml | 2 +- pom.xml | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/langchain4j-anthropic-spring-boot-starter/pom.xml b/langchain4j-anthropic-spring-boot-starter/pom.xml index 2c00be36..6b747eb7 100644 --- a/langchain4j-anthropic-spring-boot-starter/pom.xml +++ b/langchain4j-anthropic-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-azure-ai-search-spring-boot-starter/pom.xml b/langchain4j-azure-ai-search-spring-boot-starter/pom.xml index 7cfd09cd..335fb700 100644 --- a/langchain4j-azure-ai-search-spring-boot-starter/pom.xml +++ b/langchain4j-azure-ai-search-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml index cee91070..1a87fd3e 100644 --- a/langchain4j-azure-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-azure-open-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-dashscope-spring-boot-starter/pom.xml b/langchain4j-dashscope-spring-boot-starter/pom.xml index fc92a946..5af252dc 100644 --- a/langchain4j-dashscope-spring-boot-starter/pom.xml +++ b/langchain4j-dashscope-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-easy-rag-spring-boot-starter/pom.xml b/langchain4j-easy-rag-spring-boot-starter/pom.xml index a804ff7b..7701b0af 100644 --- a/langchain4j-easy-rag-spring-boot-starter/pom.xml +++ b/langchain4j-easy-rag-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-elasticsearch-spring-boot-starter/pom.xml b/langchain4j-elasticsearch-spring-boot-starter/pom.xml index d0955fd0..012bb3c7 100644 --- a/langchain4j-elasticsearch-spring-boot-starter/pom.xml +++ b/langchain4j-elasticsearch-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-github-models-spring-boot-starter/pom.xml b/langchain4j-github-models-spring-boot-starter/pom.xml index 70e0c2ac..4372fbfc 100644 --- a/langchain4j-github-models-spring-boot-starter/pom.xml +++ b/langchain4j-github-models-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-milvus-spring-boot-starter/pom.xml b/langchain4j-milvus-spring-boot-starter/pom.xml index 272161e4..1d219666 100644 --- a/langchain4j-milvus-spring-boot-starter/pom.xml +++ b/langchain4j-milvus-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-ollama-spring-boot-starter/pom.xml b/langchain4j-ollama-spring-boot-starter/pom.xml index f3505069..eecb11b5 100644 --- a/langchain4j-ollama-spring-boot-starter/pom.xml +++ b/langchain4j-ollama-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-open-ai-spring-boot-starter/pom.xml b/langchain4j-open-ai-spring-boot-starter/pom.xml index 9d44173a..6bf9d25d 100644 --- a/langchain4j-open-ai-spring-boot-starter/pom.xml +++ b/langchain4j-open-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-qianfan-spring-boot-starter/pom.xml b/langchain4j-qianfan-spring-boot-starter/pom.xml index e9ac2ef3..36fedf04 100644 --- a/langchain4j-qianfan-spring-boot-starter/pom.xml +++ b/langchain4j-qianfan-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-reactor/pom.xml b/langchain4j-reactor/pom.xml index 6a966e65..ffc80663 100644 --- a/langchain4j-reactor/pom.xml +++ b/langchain4j-reactor/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-redis-spring-boot-starter/pom.xml b/langchain4j-redis-spring-boot-starter/pom.xml index 583c8cd3..0701efd6 100644 --- a/langchain4j-redis-spring-boot-starter/pom.xml +++ b/langchain4j-redis-spring-boot-starter/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-spring-boot-starter/pom.xml b/langchain4j-spring-boot-starter/pom.xml index 29a5d49c..30440842 100644 --- a/langchain4j-spring-boot-starter/pom.xml +++ b/langchain4j-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-spring-boot-tests/pom.xml b/langchain4j-spring-boot-tests/pom.xml index d8ab8aab..8da75976 100644 --- a/langchain4j-spring-boot-tests/pom.xml +++ b/langchain4j-spring-boot-tests/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml b/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml index 967733d1..037da213 100644 --- a/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml +++ b/langchain4j-vertex-ai-gemini-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/langchain4j-voyage-ai-spring-boot-starter/pom.xml b/langchain4j-voyage-ai-spring-boot-starter/pom.xml index e1bf6e5a..1d9970ad 100644 --- a/langchain4j-voyage-ai-spring-boot-starter/pom.xml +++ b/langchain4j-voyage-ai-spring-boot-starter/pom.xml @@ -7,7 +7,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index dd76f317..b87d59d2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.langchain4j langchain4j-spring - 0.36.1 + 0.37.0-SNAPSHOT pom langchain4j-spring parent POM