From 624eb68c94a34042fa97ef930769d5e41569ea2f Mon Sep 17 00:00:00 2001 From: LangChain4j Date: Fri, 22 Dec 2023 15:36:52 +0100 Subject: [PATCH] added proxy properties --- .../dev/langchain4j/openai/spring/AutoConfig.java | 14 +++++++------- .../langchain4j/openai/spring/ProxyProperties.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) 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 9bb5150..b4c16b8 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 @@ -33,7 +33,7 @@ OpenAiChatModel openAiChatModel(Properties properties) { .user(chatModelProperties.getUser()) .timeout(chatModelProperties.getTimeout()) .maxRetries(chatModelProperties.getMaxRetries()) - .proxy(ProxyProperties.toProxy(chatModelProperties.getProxy())) + .proxy(ProxyProperties.convert(chatModelProperties.getProxy())) .logRequests(chatModelProperties.getLogRequests()) .logResponses(chatModelProperties.getLogResponses()) .build(); @@ -59,7 +59,7 @@ OpenAiStreamingChatModel openAiStreamingChatModel(Properties properties) { .seed(chatModelProperties.getSeed()) .user(chatModelProperties.getUser()) .timeout(chatModelProperties.getTimeout()) - .proxy(ProxyProperties.toProxy(chatModelProperties.getProxy())) + .proxy(ProxyProperties.convert(chatModelProperties.getProxy())) .logRequests(chatModelProperties.getLogRequests()) .logResponses(chatModelProperties.getLogResponses()) .build(); @@ -77,7 +77,7 @@ OpenAiLanguageModel openAiLanguageModel(Properties properties) { .temperature(languageModelProperties.getTemperature()) .timeout(languageModelProperties.getTimeout()) .maxRetries(languageModelProperties.getMaxRetries()) - .proxy(ProxyProperties.toProxy(languageModelProperties.getProxy())) + .proxy(ProxyProperties.convert(languageModelProperties.getProxy())) .logRequests(languageModelProperties.getLogRequests()) .logResponses(languageModelProperties.getLogResponses()) .build(); @@ -94,7 +94,7 @@ OpenAiStreamingLanguageModel openAiStreamingLanguageModel(Properties properties) .modelName(languageModelProperties.getModelName()) .temperature(languageModelProperties.getTemperature()) .timeout(languageModelProperties.getTimeout()) - .proxy(ProxyProperties.toProxy(languageModelProperties.getProxy())) + .proxy(ProxyProperties.convert(languageModelProperties.getProxy())) .logRequests(languageModelProperties.getLogRequests()) .logResponses(languageModelProperties.getLogResponses()) .build(); @@ -112,7 +112,7 @@ OpenAiEmbeddingModel openAiEmbeddingModel(Properties properties) { .user(embeddingModelProperties.getUser()) .timeout(embeddingModelProperties.getTimeout()) .maxRetries(embeddingModelProperties.getMaxRetries()) - .proxy(ProxyProperties.toProxy(embeddingModelProperties.getProxy())) + .proxy(ProxyProperties.convert(embeddingModelProperties.getProxy())) .logRequests(embeddingModelProperties.getLogRequests()) .logResponses(embeddingModelProperties.getLogResponses()) .build(); @@ -129,7 +129,7 @@ OpenAiModerationModel openAiModerationModel(Properties properties) { .modelName(moderationModelProperties.getModelName()) .timeout(moderationModelProperties.getTimeout()) .maxRetries(moderationModelProperties.getMaxRetries()) - .proxy(ProxyProperties.toProxy(moderationModelProperties.getProxy())) + .proxy(ProxyProperties.convert(moderationModelProperties.getProxy())) .logRequests(moderationModelProperties.getLogRequests()) .logResponses(moderationModelProperties.getLogResponses()) .build(); @@ -151,7 +151,7 @@ OpenAiImageModel openAiImageModel(Properties properties) { .responseFormat(imageModelProperties.getResponseFormat()) .timeout(imageModelProperties.getTimeout()) .maxRetries(imageModelProperties.getMaxRetries()) - .proxy(ProxyProperties.toProxy(imageModelProperties.getProxy())) + .proxy(ProxyProperties.convert(imageModelProperties.getProxy())) .logRequests(imageModelProperties.getLogRequests()) .logResponses(imageModelProperties.getLogResponses()) .withPersisting(imageModelProperties.getWithPersisting()) 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 429bb17..141af32 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 @@ -14,7 +14,7 @@ class ProxyProperties { String host; Integer port; - static Proxy toProxy(ProxyProperties proxy) { + static Proxy convert(ProxyProperties proxy) { if (proxy == null) { return null; }