diff --git a/src/main/java/com/aoelite/claude/ClaudeClient.java b/src/main/java/com/aoelite/claude/ClaudeClient.java index 00038a6..3c9c07b 100644 --- a/src/main/java/com/aoelite/claude/ClaudeClient.java +++ b/src/main/java/com/aoelite/claude/ClaudeClient.java @@ -105,7 +105,7 @@ private JsonObject sendRequestAndGetJson(ClaudeRequest request) { public JsonObject generateJsonRequest(ClaudeRequest request) { JsonObject object = new JsonObject(); - object.addProperty("model", request.getModel().getId()); + object.addProperty("model", request.getAIModel().getId()); object.addProperty("max_tokens", request.getMax_tokens()); object.addProperty("temperature", request.getTemperature()); diff --git a/src/main/java/com/aoelite/claude/data/ClaudeRequest.java b/src/main/java/com/aoelite/claude/data/ClaudeRequest.java index c5cb033..2e9290f 100644 --- a/src/main/java/com/aoelite/claude/data/ClaudeRequest.java +++ b/src/main/java/com/aoelite/claude/data/ClaudeRequest.java @@ -1,9 +1,7 @@ package com.aoelite.claude.data; -import com.aoelite.claude.data.input.ClaudeMessage; import com.aoelite.claude.data.input.RoleInput; -import com.aoelite.claude.data.input.TextMessage; -import com.aoelite.claude.data.types.ClaudeModel; +import com.aoelite.claude.data.types.AIModel; import lombok.*; import org.jetbrains.annotations.Nullable; @@ -15,7 +13,7 @@ @Builder public class ClaudeRequest { - @NonNull private final ClaudeModel model; + @NonNull private final AIModel AIModel; @Builder.Default private final int max_tokens = 1000; @Nullable private String system; @Nullable @Singular private List stop_sequences; diff --git a/src/main/java/com/aoelite/claude/data/types/AIModel.java b/src/main/java/com/aoelite/claude/data/types/AIModel.java new file mode 100644 index 0000000..7461104 --- /dev/null +++ b/src/main/java/com/aoelite/claude/data/types/AIModel.java @@ -0,0 +1,7 @@ +package com.aoelite.claude.data.types; + +public interface AIModel { + + String getId(); + +} diff --git a/src/main/java/com/aoelite/claude/data/types/ClaudeModel.java b/src/main/java/com/aoelite/claude/data/types/ClaudeAIModel.java similarity index 59% rename from src/main/java/com/aoelite/claude/data/types/ClaudeModel.java rename to src/main/java/com/aoelite/claude/data/types/ClaudeAIModel.java index f66e843..38bdda8 100644 --- a/src/main/java/com/aoelite/claude/data/types/ClaudeModel.java +++ b/src/main/java/com/aoelite/claude/data/types/ClaudeAIModel.java @@ -3,20 +3,21 @@ import lombok.Getter; @Getter -public enum ClaudeModel { +public enum ClaudeAIModel implements AIModel { HAIKU("claude-3-haiku-20240307"), SONNET("claude-3-sonnet-20240229"), - OPUS("claude-3-opus-20240229"); + OPUS("claude-3-opus-20240229"), + SONNET_3_5("claude-3-5-sonnet-20240620"); private final String id; - ClaudeModel(String id) { + ClaudeAIModel(String id) { this.id = id; } - public static ClaudeModel fromId(String id) { - for (ClaudeModel model : values()) { + public static ClaudeAIModel fromId(String id) { + for (ClaudeAIModel model : values()) { if (model.id.equals(id)) { return model; } diff --git a/src/main/java/com/aoelite/claude/example/ExampleA.java b/src/main/java/com/aoelite/claude/example/ExampleA.java index 2957134..c4c8400 100644 --- a/src/main/java/com/aoelite/claude/example/ExampleA.java +++ b/src/main/java/com/aoelite/claude/example/ExampleA.java @@ -6,7 +6,7 @@ import com.aoelite.claude.data.ClaudeResponse; import com.aoelite.claude.data.input.RoleInput; import com.aoelite.claude.data.input.TextMessage; -import com.aoelite.claude.data.types.ClaudeModel; +import com.aoelite.claude.data.types.ClaudeAIModel; import com.aoelite.claude.data.types.ClaudeRole; public class ExampleA { @@ -16,7 +16,7 @@ public static void main(String[] args) { ClaudeAPI client = new ClaudeClient("YOUR_API_KEY"); ClaudeResponse response = client.sendRequest(ClaudeRequest.builder() - .model(ClaudeModel.HAIKU) + .AIModel(ClaudeAIModel.HAIKU) .max_tokens(100) .temperature(0) .stop_sequence("###")