Skip to content

Commit

Permalink
refactor: add missing implementations for request/response concrete c…
Browse files Browse the repository at this point in the history
…lasses
  • Loading branch information
carlrobertoh committed Sep 23, 2024
1 parent cb2a134 commit 0940ecb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

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;

/**
* <a
* href="https://ai.google.dev/api/rest/v1/GenerateContentResponse?authuser=1">GenerateContentResponse</a>.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoogleCompletionResponse {
public class GoogleCompletionResponse implements CompletionResponse {

private List<Candidate> candidates;
private PromptFeedback promptFeedback;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-chat-completion">ollama/api</a>
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OllamaChatCompletionRequest {
public class OllamaChatCompletionRequest implements CompletionRequest {

private final String model;
private final List<OllamaChatCompletionMessage> messages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0940ecb

Please sign in to comment.