From 0940ecb8e83956c273f62e63f007b4f1bc4550cb Mon Sep 17 00:00:00 2001 From: Carl-Robert Linnupuu Date: Sun, 22 Sep 2024 20:41:16 +0300 Subject: [PATCH] refactor: add missing implementations for request/response concrete classes --- .../llm/client/google/completion/GoogleCompletionResponse.java | 3 ++- .../llm/client/llama/completion/LlamaCompletionResponse.java | 3 ++- .../ollama/completion/request/OllamaChatCompletionRequest.java | 3 ++- .../completion/response/OllamaChatCompletionResponse.java | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/ee/carlrobert/llm/client/google/completion/GoogleCompletionResponse.java b/src/main/java/ee/carlrobert/llm/client/google/completion/GoogleCompletionResponse.java index 5a9384e..34fd564 100644 --- a/src/main/java/ee/carlrobert/llm/client/google/completion/GoogleCompletionResponse.java +++ b/src/main/java/ee/carlrobert/llm/client/google/completion/GoogleCompletionResponse.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import ee.carlrobert.llm.client.google.completion.GoogleCompletionRequest.HarmCategory; +import ee.carlrobert.llm.completion.CompletionResponse; import java.util.List; /** @@ -9,7 +10,7 @@ * href="https://ai.google.dev/api/rest/v1/GenerateContentResponse?authuser=1">GenerateContentResponse. */ @JsonIgnoreProperties(ignoreUnknown = true) -public class GoogleCompletionResponse { +public class GoogleCompletionResponse implements CompletionResponse { private List candidates; private PromptFeedback promptFeedback; diff --git a/src/main/java/ee/carlrobert/llm/client/llama/completion/LlamaCompletionResponse.java b/src/main/java/ee/carlrobert/llm/client/llama/completion/LlamaCompletionResponse.java index 08aa2c5..5ee051d 100644 --- a/src/main/java/ee/carlrobert/llm/client/llama/completion/LlamaCompletionResponse.java +++ b/src/main/java/ee/carlrobert/llm/client/llama/completion/LlamaCompletionResponse.java @@ -1,9 +1,10 @@ package ee.carlrobert.llm.client.llama.completion; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import ee.carlrobert.llm.completion.CompletionResponse; @JsonIgnoreProperties(ignoreUnknown = true) -public class LlamaCompletionResponse { +public class LlamaCompletionResponse implements CompletionResponse { private String content; private boolean stop; diff --git a/src/main/java/ee/carlrobert/llm/client/ollama/completion/request/OllamaChatCompletionRequest.java b/src/main/java/ee/carlrobert/llm/client/ollama/completion/request/OllamaChatCompletionRequest.java index f5cd864..be246c2 100644 --- a/src/main/java/ee/carlrobert/llm/client/ollama/completion/request/OllamaChatCompletionRequest.java +++ b/src/main/java/ee/carlrobert/llm/client/ollama/completion/request/OllamaChatCompletionRequest.java @@ -2,13 +2,14 @@ import com.fasterxml.jackson.annotation.JsonInclude; import ee.carlrobert.llm.client.ollama.completion.response.OllamaResponseFormat; +import ee.carlrobert.llm.completion.CompletionRequest; import java.util.List; /* * See ollama/api */ @JsonInclude(JsonInclude.Include.NON_NULL) -public class OllamaChatCompletionRequest { +public class OllamaChatCompletionRequest implements CompletionRequest { private final String model; private final List messages; diff --git a/src/main/java/ee/carlrobert/llm/client/ollama/completion/response/OllamaChatCompletionResponse.java b/src/main/java/ee/carlrobert/llm/client/ollama/completion/response/OllamaChatCompletionResponse.java index a2331c0..7edab57 100644 --- a/src/main/java/ee/carlrobert/llm/client/ollama/completion/response/OllamaChatCompletionResponse.java +++ b/src/main/java/ee/carlrobert/llm/client/ollama/completion/response/OllamaChatCompletionResponse.java @@ -3,12 +3,13 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; +import ee.carlrobert.llm.completion.CompletionResponse; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) @JsonIgnoreProperties(ignoreUnknown = true) -public class OllamaChatCompletionResponse { +public class OllamaChatCompletionResponse implements CompletionResponse { private String model; private String createdAt;