-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of lombok for langchain4j-azure-open-ai-spring-boot-sarter (#51)
## Issue Langchain4j project issue: langchain4j/langchain4j#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)
- Loading branch information
Showing
6 changed files
with
131 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 22 additions & 26 deletions
48
...g-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ChatModelProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, Integer> logitBias; | ||
String user; | ||
List<String> stop; | ||
Double presencePenalty; | ||
Double frequencyPenalty; | ||
Long seed; | ||
String responseFormat; | ||
Integer timeout; // TODO use Duration instead | ||
Integer maxRetries; | ||
Boolean logRequestsAndResponses; | ||
String userAgentSuffix; | ||
Map<String, String> customHeaders; | ||
String nonAzureApiKey; | ||
String endpoint, | ||
String serviceVersion, | ||
String apiKey, | ||
String deploymentName, | ||
Integer maxTokens, | ||
Double temperature, | ||
Double topP, | ||
Map<String, Integer> logitBias, | ||
String user, | ||
List<String> stop, | ||
Double presencePenalty, | ||
Double frequencyPenalty, | ||
Long seed, | ||
String responseFormat, | ||
Integer timeout, // TODO use Duration instead | ||
Integer maxRetries, | ||
Boolean logRequestsAndResponses, | ||
String userAgentSuffix, | ||
Map<String, String> customHeaders, | ||
String nonAzureApiKey | ||
) { | ||
} |
30 changes: 13 additions & 17 deletions
30
...t-starter/src/main/java/dev/langchain4j/azure/openai/spring/EmbeddingModelProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, String> 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<String, String> customHeaders, | ||
String nonAzureApiKey | ||
) { | ||
} |
38 changes: 17 additions & 21 deletions
38
...-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/ImageModelProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, String> 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<String, String> customHeaders, | ||
String nonAzureApiKey | ||
){ | ||
} |
18 changes: 7 additions & 11 deletions
18
...-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/Properties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
} |