Skip to content

Commit

Permalink
langchain4j-ollama get rid of lombok (langchain4j#1658)
Browse files Browse the repository at this point in the history
## Issue
langchain4j#1636 

## Change
`langchain4j-ollama` get rid of `lombok`

## 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
- [x] 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
<!-- Before adding documentation and example(s) (below), please wait
until the PR is reviewed and approved. -->
- [ ] 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
Martin7-1 authored Sep 10, 2024
1 parent ff243b0 commit 7c5e351
Show file tree
Hide file tree
Showing 34 changed files with 2,239 additions and 268 deletions.
6 changes: 0 additions & 6 deletions langchain4j-ollama/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@
</dependency>
<!-- DEPENDENCY CONFLICT RESOLUTION FOR OKHTTP (END) -->

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,11 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(NON_NULL)
@JsonNaming(SnakeCaseStrategy.class)
Expand All @@ -28,4 +20,113 @@ class ChatRequest {
private String format;
private Boolean stream;
private List<Tool> tools;

ChatRequest() {

}

ChatRequest(String model, List<Message> messages, Options options, Boolean stream, List<Tool> tools, String format) {
this.model = model;
this.messages = messages;
this.options = options;
this.stream = stream;
this.tools = tools;
this.format = format;
}

static Builder builder() {
return new Builder();
}

public String getModel() {
return model;
}

public void setModel(String model) {
this.model = model;
}

public List<Message> getMessages() {
return messages;
}

public void setMessages(List<Message> messages) {
this.messages = messages;
}

public Options getOptions() {
return options;
}

public void setOptions(Options options) {
this.options = options;
}

public String getFormat() {
return format;
}

public void setFormat(String format) {
this.format = format;
}

public Boolean getStream() {
return stream;
}

public void setStream(Boolean stream) {
this.stream = stream;
}

public List<Tool> getTools() {
return tools;
}

public void setTools(List<Tool> tools) {
this.tools = tools;
}

static class Builder {

private String model;
private List<Message> messages;
private Options options;
private String format;
private Boolean stream;
private List<Tool> tools;

Builder model(String model) {
this.model = model;
return this;
}

Builder messages(List<Message> messages) {
this.messages = messages;
return this;
}

Builder options(Options options) {
this.options = options;
return this;
}

Builder format(String format) {
this.format = format;
return this;
}

Builder stream(Boolean stream) {
this.stream = stream;
return this;
}

Builder tools(List<Tool> tools) {
this.tools = tools;
return this;
}

ChatRequest build() {
return new ChatRequest(model, messages, options, stream, tools, format);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(NON_NULL)
@JsonNaming(SnakeCaseStrategy.class)
Expand All @@ -26,4 +18,113 @@ class ChatResponse {
private Boolean done;
private Integer promptEvalCount;
private Integer evalCount;

ChatResponse() {

}

ChatResponse(String model, String createdAt, Message message, Boolean done, Integer promptEvalCount, Integer evalCount) {
this.model = model;
this.createdAt = createdAt;
this.message = message;
this.done = done;
this.promptEvalCount = promptEvalCount;
this.evalCount = evalCount;
}

static Builder builder() {
return new Builder();
}

public String getModel() {
return model;
}

public void setModel(String model) {
this.model = model;
}

public String getCreatedAt() {
return createdAt;
}

public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}

public Message getMessage() {
return message;
}

public void setMessage(Message message) {
this.message = message;
}

public Boolean getDone() {
return done;
}

public void setDone(Boolean done) {
this.done = done;
}

public Integer getPromptEvalCount() {
return promptEvalCount;
}

public void setPromptEvalCount(Integer promptEvalCount) {
this.promptEvalCount = promptEvalCount;
}

public Integer getEvalCount() {
return evalCount;
}

public void setEvalCount(Integer evalCount) {
this.evalCount = evalCount;
}

static class Builder {

private String model;
private String createdAt;
private Message message;
private Boolean done;
private Integer promptEvalCount;
private Integer evalCount;

Builder model(String model) {
this.model = model;
return this;
}

Builder createdAt(String createdAt) {
this.createdAt = createdAt;
return this;
}

Builder message(Message message) {
this.message = message;
return this;
}

Builder done(Boolean done) {
this.done = done;
return this;
}

Builder promptEvalCount(Integer promptEvalCount) {
this.promptEvalCount = promptEvalCount;
return this;
}

Builder evalCount(Integer evalCount) {
this.evalCount = evalCount;
return this;
}

ChatResponse build() {
return new ChatResponse(model, createdAt, message, done, promptEvalCount, evalCount);
}
}
}
Loading

0 comments on commit 7c5e351

Please sign in to comment.