From f36341652e695cf7b41983e4026c6a7d797604d7 Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Fri, 12 Jan 2024 11:59:25 +0200 Subject: [PATCH] Rename chatjpt to jvm-openai --- README.md | 24 ++++++------ build.gradle | 12 +++--- settings.gradle | 2 +- .../{chatjpt => jvm/openai}/Assistant.java | 2 +- .../openai}/AssistantFile.java | 2 +- .../openai}/AssistantsClient.java | 2 +- .../{chatjpt => jvm/openai}/AudioClient.java | 2 +- .../openai}/ChatChunkResponse.java | 2 +- .../{chatjpt => jvm/openai}/ChatClient.java | 2 +- .../{chatjpt => jvm/openai}/ChatMessage.java | 8 ++-- .../{chatjpt => jvm/openai}/ChatRequest.java | 2 +- .../{chatjpt => jvm/openai}/ChatResponse.java | 2 +- .../{chatjpt => jvm/openai}/Constants.java | 2 +- .../openai}/CreateAssistantRequest.java | 2 +- .../openai}/CreateFineTuningJobRequest.java | 2 +- .../openai}/CreateImageRequest.java | 2 +- .../openai}/CreateImageVariationRequest.java | 2 +- .../openai}/CreateMessageRequest.java | 2 +- .../openai}/CreateRunRequest.java | 2 +- .../openai}/CreateThreadAndRunRequest.java | 2 +- .../openai}/CreateThreadRequest.java | 2 +- .../openai}/DeletionStatus.java | 2 +- .../openai}/EditImageRequest.java | 2 +- .../{chatjpt => jvm/openai}/Embeddings.java | 2 +- .../openai}/EmbeddingsClient.java | 2 +- .../openai}/EmbeddingsRequest.java | 2 +- .../{chatjpt => jvm/openai}/Endpoint.java | 2 +- .../{chatjpt => jvm/openai}/File.java | 2 +- .../{chatjpt => jvm/openai}/FilesClient.java | 2 +- .../openai}/FineTuningClient.java | 2 +- .../openai}/FineTuningJob.java | 2 +- .../openai}/FineTuningJobEvent.java | 2 +- .../{chatjpt => jvm/openai}/Images.java | 2 +- .../{chatjpt => jvm/openai}/ImagesClient.java | 2 +- .../{chatjpt => jvm/openai}/Logprobs.java | 2 +- .../openai}/MessagesClient.java | 2 +- .../{chatjpt => jvm/openai}/Model.java | 2 +- .../{chatjpt => jvm/openai}/ModelsClient.java | 2 +- .../{chatjpt => jvm/openai}/Moderation.java | 2 +- .../openai}/ModerationRequest.java | 2 +- .../openai}/ModerationsClient.java | 2 +- .../openai}/ModifyAssistantRequest.java | 2 +- .../openai}/ModifyMessageRequest.java | 2 +- .../openai}/ModifyRunRequest.java | 2 +- .../openai}/ModifyThreadRequest.java | 2 +- .../openai}/MultipartBodyPublisher.java | 2 +- .../ChatJPT.java => jvm/openai/OpenAI.java} | 11 +++--- .../openai}/OpenAIAssistantsClient.java | 2 +- .../{chatjpt => jvm/openai}/OpenAIClient.java | 2 +- .../openai}/OpenAIException.java | 2 +- .../openai}/PaginationQueryParameters.java | 2 +- .../{chatjpt => jvm/openai}/RunsClient.java | 2 +- .../openai}/SpeechRequest.java | 2 +- .../openai}/SubmitToolOutputsRequest.java | 2 +- .../{chatjpt => jvm/openai}/Thread.java | 2 +- .../openai}/ThreadMessage.java | 2 +- .../openai}/ThreadMessageFile.java | 2 +- .../{chatjpt => jvm/openai}/ThreadRun.java | 2 +- .../openai}/ThreadRunStep.java | 2 +- .../openai}/ThreadsClient.java | 2 +- .../{chatjpt => jvm/openai}/Tool.java | 4 +- .../{chatjpt => jvm/openai}/ToolCall.java | 8 ++-- .../{chatjpt => jvm/openai}/ToolChoice.java | 2 +- .../openai}/TranscriptionRequest.java | 2 +- .../openai}/TranslationRequest.java | 2 +- .../openai}/UploadFileRequest.java | 2 +- .../OpenAIAssistantsApiIntegrationTest.java} | 33 +++++++++-------- .../openai/OpenAIIntegrationTest.java} | 37 +++++++++---------- .../openai/OpenAIIntegrationTestBase.java} | 12 +++--- 69 files changed, 135 insertions(+), 134 deletions(-) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Assistant.java (88%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/AssistantFile.java (73%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/AssistantsClient.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/AudioClient.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ChatChunkResponse.java (92%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ChatClient.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ChatMessage.java (89%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ChatRequest.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ChatResponse.java (93%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Constants.java (97%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/CreateAssistantRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/CreateFineTuningJobRequest.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/CreateImageRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/CreateImageVariationRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/CreateMessageRequest.java (97%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/CreateRunRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/CreateThreadAndRunRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/CreateThreadRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/DeletionStatus.java (57%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/EditImageRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Embeddings.java (86%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/EmbeddingsClient.java (96%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/EmbeddingsRequest.java (97%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Endpoint.java (92%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/File.java (67%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/FilesClient.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/FineTuningClient.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/FineTuningJob.java (94%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/FineTuningJobEvent.java (67%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Images.java (79%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ImagesClient.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Logprobs.java (87%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/MessagesClient.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Model.java (59%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ModelsClient.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Moderation.java (97%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ModerationRequest.java (97%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ModerationsClient.java (96%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ModifyAssistantRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ModifyMessageRequest.java (94%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ModifyRunRequest.java (94%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ModifyThreadRequest.java (94%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/MultipartBodyPublisher.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt/ChatJPT.java => jvm/openai/OpenAI.java} (96%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/OpenAIAssistantsClient.java (96%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/OpenAIClient.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/OpenAIException.java (95%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/PaginationQueryParameters.java (97%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/RunsClient.java (99%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/SpeechRequest.java (97%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/SubmitToolOutputsRequest.java (95%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Thread.java (84%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ThreadMessage.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ThreadMessageFile.java (73%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ThreadRun.java (94%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ThreadRunStep.java (97%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ThreadsClient.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/Tool.java (96%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ToolCall.java (92%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/ToolChoice.java (85%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/TranscriptionRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/TranslationRequest.java (98%) rename src/main/java/io/github/stefanbratanov/{chatjpt => jvm/openai}/UploadFileRequest.java (95%) rename src/test/java/io/github/stefanbratanov/{chatjpt/ChatJPTAssistantsApiIntegrationTest.java => jvm/openai/OpenAIAssistantsApiIntegrationTest.java} (91%) rename src/test/java/io/github/stefanbratanov/{chatjpt/ChatJPTIntegrationTest.java => jvm/openai/OpenAIIntegrationTest.java} (86%) rename src/test/java/io/github/stefanbratanov/{chatjpt/ChatJPTIntegrationTestBase.java => jvm/openai/OpenAIIntegrationTestBase.java} (86%) diff --git a/README.md b/README.md index 4591d84..35a2b43 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# ChatJPT +# jvm-openai -[![build](https://github.com/StefanBratanov/chatjpt/actions/workflows/build.yml/badge.svg)](https://github.com/StefanBratanov/chatjpt/actions/workflows/build.yml) -[![Maven Central](https://img.shields.io/maven-central/v/io.github.stefanbratanov/chatjpt)](https://central.sonatype.com/artifact/io.github.stefanbratanov/chatjpt) -[![javadoc](https://javadoc.io/badge2/io.github.stefanbratanov/chatjpt/javadoc.svg)](https://javadoc.io/doc/io.github.stefanbratanov/chatjpt) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=StefanBratanov_chatjpt&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=StefanBratanov_chatjpt) +[![build](https://github.com/StefanBratanov/jvm-openai/actions/workflows/build.yml/badge.svg)](https://github.com/StefanBratanov/jvm-openai/actions/workflows/build.yml) +[![Maven Central](https://img.shields.io/maven-central/v/io.github.stefanbratanov/jvm-openai)](https://central.sonatype.com/artifact/io.github.stefanbratanov/jvm-openai) +[![javadoc](https://javadoc.io/badge2/io.github.stefanbratanov/jvm-openai/javadoc.svg)](https://javadoc.io/doc/io.github.stefanbratanov/jvm-openai) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=StefanBratanov_jvm-openai&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=StefanBratanov_jvm-openai) -A minimalistic unofficial Java client for the [OpenAI API](https://platform.openai.com/docs/api-reference) +A minimalistic unofficial JVM client for the [OpenAI API](https://platform.openai.com/docs/api-reference) written in Java ## Add dependency @@ -14,16 +14,16 @@ Java 17+ is a prerequisite #### Gradle ```groovy -implementation("io.github.stefanbratanov:chatjpt:${version}") +implementation("io.github.stefanbratanov:jvm-openai:${version}") ``` #### Maven - +F ```xml io.github.stefanbratanov - chatjpt + jvm-openai ${version} ``` @@ -31,9 +31,9 @@ implementation("io.github.stefanbratanov:chatjpt:${version}") ## Minimal sample ```java -ChatJPT chatJPT = ChatJPT.newBuilder(System.getenv("OPENAI_API_KEY")).build(); +OpenAI openAI = OpenAI.newBuilder(System.getenv("OPENAI_API_KEY")).build(); -ChatClient chatClient = chatJPT.chatClient(); +ChatClient chatClient = openAI.chatClient(); ChatRequest chatRequest = ChatRequest.newBuilder() .model("gpt-3.5-turbo") .message(ChatMessage.userMessage("Who won the world series in 2020?")) @@ -41,7 +41,7 @@ ChatRequest chatRequest = ChatRequest.newBuilder() ChatResponse response = chatClient.sendRequest(chatRequest); // ChatResponse[id=chatcmpl-123, created=1703506594, model=gpt-3.5-turbo-0613, systemFingerprint=fp_44709d6fcb, choices=[Choice[index=0, message=Message[content=The Los Angeles Dodgers won the World Series in 2020., toolCalls=null, role=assistant], logProbs=null, finishReason=stop]], usage=Usage[promptTokens=17, completionTokens=13, totalTokens=30]] -ImagesClient imagesClient = chatJPT.imagesClient(); +ImagesClient imagesClient = openAI.imagesClient(); CreateImageRequest createImageRequest = CreateImageRequest.newBuilder() .model("dall-e-3") .prompt("A cute baby sea otter") diff --git a/build.gradle b/build.gradle index 1152fc4..8d9d947 100644 --- a/build.gradle +++ b/build.gradle @@ -49,9 +49,9 @@ publishing { from components.java pom { - name = "ChatJPT" - description = "A minimalistic Java client for the OpenAI API" - url = "https://github.com/StefanBratanov/chatjpt" + name = "jvm-openai" + description = "A minimalistic JVM client for the OpenAI API written in Java" + url = "https://github.com/StefanBratanov/jvm-openai" licenses { license { name = "The Apache License, Version 2.0" @@ -66,9 +66,9 @@ publishing { } } scm { - connection = "scm:git:git://github.com/StefanBratanov/chatjpt.git" - developerConnection = "scm:git:ssh://github.com/StefanBratanov/chatjpt.git" - url = "https://github.com/StefanBratanov/chatjpt" + connection = "scm:git:git://github.com/StefanBratanov/jvm-openai.git" + developerConnection = "scm:git:ssh://github.com/StefanBratanov/jvm-openai.git" + url = "https://github.com/StefanBratanov/jvm-openai" } } } diff --git a/settings.gradle b/settings.gradle index fd84993..24e4672 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -rootProject.name = "chatjpt" +rootProject.name = "jvm-openai" diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/Assistant.java b/src/main/java/io/github/stefanbratanov/jvm/openai/Assistant.java similarity index 88% rename from src/main/java/io/github/stefanbratanov/chatjpt/Assistant.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/Assistant.java index 9d3a65b..0d73038 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/Assistant.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/Assistant.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; import java.util.Map; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/AssistantFile.java b/src/main/java/io/github/stefanbratanov/jvm/openai/AssistantFile.java similarity index 73% rename from src/main/java/io/github/stefanbratanov/chatjpt/AssistantFile.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/AssistantFile.java index bbf10be..a181ffc 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/AssistantFile.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/AssistantFile.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; /** A list of Files attached to an assistant. */ public record AssistantFile(String id, long createdAt, String assistantId) {} diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/AssistantsClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/AssistantsClient.java similarity index 99% rename from src/main/java/io/github/stefanbratanov/chatjpt/AssistantsClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/AssistantsClient.java index dddd76d..c5ce82b 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/AssistantsClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/AssistantsClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/AudioClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/AudioClient.java similarity index 99% rename from src/main/java/io/github/stefanbratanov/chatjpt/AudioClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/AudioClient.java index 19c7932..52ce082 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/AudioClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/AudioClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ChatChunkResponse.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatChunkResponse.java similarity index 92% rename from src/main/java/io/github/stefanbratanov/chatjpt/ChatChunkResponse.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ChatChunkResponse.java index bdf1cc6..6e7243f 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ChatChunkResponse.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatChunkResponse.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ChatClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatClient.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/ChatClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ChatClient.java index 38ff030..484b38f 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ChatClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ChatMessage.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatMessage.java similarity index 89% rename from src/main/java/io/github/stefanbratanov/chatjpt/ChatMessage.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ChatMessage.java index 669616e..c7defa9 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ChatMessage.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatMessage.java @@ -1,9 +1,9 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.annotation.JsonProperty; -import io.github.stefanbratanov.chatjpt.ChatMessage.UserMessage.UserMessageWithContentParts; -import io.github.stefanbratanov.chatjpt.ChatMessage.UserMessage.UserMessageWithContentParts.ContentPart; -import io.github.stefanbratanov.chatjpt.ChatMessage.UserMessage.UserMessageWithTextContent; +import io.github.stefanbratanov.jvm.openai.ChatMessage.UserMessage.UserMessageWithContentParts; +import io.github.stefanbratanov.jvm.openai.ChatMessage.UserMessage.UserMessageWithContentParts.ContentPart; +import io.github.stefanbratanov.jvm.openai.ChatMessage.UserMessage.UserMessageWithTextContent; import java.util.Arrays; import java.util.List; import java.util.Optional; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ChatRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatRequest.java similarity index 99% rename from src/main/java/io/github/stefanbratanov/chatjpt/ChatRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ChatRequest.java index 847ef44..8861997 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ChatRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.*; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ChatResponse.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatResponse.java similarity index 93% rename from src/main/java/io/github/stefanbratanov/chatjpt/ChatResponse.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ChatResponse.java index 70a308c..5aa62de 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ChatResponse.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ChatResponse.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/Constants.java b/src/main/java/io/github/stefanbratanov/jvm/openai/Constants.java similarity index 97% rename from src/main/java/io/github/stefanbratanov/chatjpt/Constants.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/Constants.java index b01dafa..263776e 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/Constants.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/Constants.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; class Constants { diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/CreateAssistantRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateAssistantRequest.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/CreateAssistantRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/CreateAssistantRequest.java index 13bdc51..6c9ef27 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/CreateAssistantRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateAssistantRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/CreateFineTuningJobRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateFineTuningJobRequest.java similarity index 99% rename from src/main/java/io/github/stefanbratanov/chatjpt/CreateFineTuningJobRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/CreateFineTuningJobRequest.java index d4a4f90..f82b7f5 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/CreateFineTuningJobRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateFineTuningJobRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.Optional; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/CreateImageRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateImageRequest.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/CreateImageRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/CreateImageRequest.java index 19489b2..070fec5 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/CreateImageRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateImageRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.Optional; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/CreateImageVariationRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateImageVariationRequest.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/CreateImageVariationRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/CreateImageVariationRequest.java index 6cce983..9da5a4e 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/CreateImageVariationRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateImageVariationRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.nio.file.Path; import java.util.Optional; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/CreateMessageRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateMessageRequest.java similarity index 97% rename from src/main/java/io/github/stefanbratanov/chatjpt/CreateMessageRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/CreateMessageRequest.java index e6d172c..d28e628 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/CreateMessageRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateMessageRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; import java.util.Map; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/CreateRunRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateRunRequest.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/CreateRunRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/CreateRunRequest.java index 26cca9b..9083978 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/CreateRunRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateRunRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; import java.util.Map; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/CreateThreadAndRunRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateThreadAndRunRequest.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/CreateThreadAndRunRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/CreateThreadAndRunRequest.java index 64331bf..b1884c9 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/CreateThreadAndRunRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateThreadAndRunRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; import java.util.Map; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/CreateThreadRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateThreadRequest.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/CreateThreadRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/CreateThreadRequest.java index 0f6becc..fcf25a6 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/CreateThreadRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/CreateThreadRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/DeletionStatus.java b/src/main/java/io/github/stefanbratanov/jvm/openai/DeletionStatus.java similarity index 57% rename from src/main/java/io/github/stefanbratanov/chatjpt/DeletionStatus.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/DeletionStatus.java index 5255836..c542afe 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/DeletionStatus.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/DeletionStatus.java @@ -1,3 +1,3 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; public record DeletionStatus(String id, boolean deleted) {} diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/EditImageRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/EditImageRequest.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/EditImageRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/EditImageRequest.java index 679f5d8..de7bf4d 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/EditImageRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/EditImageRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.nio.file.Path; import java.util.Optional; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/Embeddings.java b/src/main/java/io/github/stefanbratanov/jvm/openai/Embeddings.java similarity index 86% rename from src/main/java/io/github/stefanbratanov/chatjpt/Embeddings.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/Embeddings.java index 357dad4..18138ff 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/Embeddings.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/Embeddings.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/EmbeddingsClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/EmbeddingsClient.java similarity index 96% rename from src/main/java/io/github/stefanbratanov/chatjpt/EmbeddingsClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/EmbeddingsClient.java index 13e2cb6..32fae67 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/EmbeddingsClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/EmbeddingsClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/EmbeddingsRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/EmbeddingsRequest.java similarity index 97% rename from src/main/java/io/github/stefanbratanov/chatjpt/EmbeddingsRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/EmbeddingsRequest.java index 2c8d633..ef982e7 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/EmbeddingsRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/EmbeddingsRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/Endpoint.java b/src/main/java/io/github/stefanbratanov/jvm/openai/Endpoint.java similarity index 92% rename from src/main/java/io/github/stefanbratanov/chatjpt/Endpoint.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/Endpoint.java index 9aab8ba..8d3ac7f 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/Endpoint.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/Endpoint.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; enum Endpoint { CHAT("chat/completions"), diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/File.java b/src/main/java/io/github/stefanbratanov/jvm/openai/File.java similarity index 67% rename from src/main/java/io/github/stefanbratanov/chatjpt/File.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/File.java index 9855c20..27a44b4 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/File.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/File.java @@ -1,3 +1,3 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; public record File(String id, int bytes, long createdAt, String filename, String purpose) {} diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/FilesClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/FilesClient.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/FilesClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/FilesClient.java index c5d41d8..752b20e 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/FilesClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/FilesClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/FineTuningClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningClient.java similarity index 99% rename from src/main/java/io/github/stefanbratanov/chatjpt/FineTuningClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningClient.java index 2cbfa73..9b30917 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/FineTuningClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/FineTuningJob.java b/src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningJob.java similarity index 94% rename from src/main/java/io/github/stefanbratanov/chatjpt/FineTuningJob.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningJob.java index bf610c9..1dc7ee3 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/FineTuningJob.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningJob.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/FineTuningJobEvent.java b/src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningJobEvent.java similarity index 67% rename from src/main/java/io/github/stefanbratanov/chatjpt/FineTuningJobEvent.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningJobEvent.java index 0c60658..4d296b9 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/FineTuningJobEvent.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/FineTuningJobEvent.java @@ -1,3 +1,3 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; public record FineTuningJobEvent(String id, long createdAt, String level, String message) {} diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/Images.java b/src/main/java/io/github/stefanbratanov/jvm/openai/Images.java similarity index 79% rename from src/main/java/io/github/stefanbratanov/chatjpt/Images.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/Images.java index 5b1f7de..f581b6f 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/Images.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/Images.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.net.URL; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ImagesClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ImagesClient.java similarity index 99% rename from src/main/java/io/github/stefanbratanov/chatjpt/ImagesClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ImagesClient.java index 56ead28..ff0d67b 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ImagesClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ImagesClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/Logprobs.java b/src/main/java/io/github/stefanbratanov/jvm/openai/Logprobs.java similarity index 87% rename from src/main/java/io/github/stefanbratanov/chatjpt/Logprobs.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/Logprobs.java index 41a22c2..b842dbc 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/Logprobs.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/Logprobs.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/MessagesClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/MessagesClient.java similarity index 99% rename from src/main/java/io/github/stefanbratanov/chatjpt/MessagesClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/MessagesClient.java index d90649f..ce48333 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/MessagesClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/MessagesClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/Model.java b/src/main/java/io/github/stefanbratanov/jvm/openai/Model.java similarity index 59% rename from src/main/java/io/github/stefanbratanov/chatjpt/Model.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/Model.java index 0fb8a13..4b9b407 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/Model.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/Model.java @@ -1,3 +1,3 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; public record Model(String id, long created, String ownedBy) {} diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ModelsClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ModelsClient.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/ModelsClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ModelsClient.java index 40f8372..e3af07c 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ModelsClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ModelsClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/Moderation.java b/src/main/java/io/github/stefanbratanov/jvm/openai/Moderation.java similarity index 97% rename from src/main/java/io/github/stefanbratanov/chatjpt/Moderation.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/Moderation.java index 2924cc8..7371cae 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/Moderation.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/Moderation.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ModerationRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ModerationRequest.java similarity index 97% rename from src/main/java/io/github/stefanbratanov/chatjpt/ModerationRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ModerationRequest.java index c395c19..6a1f746 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ModerationRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ModerationRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ModerationsClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ModerationsClient.java similarity index 96% rename from src/main/java/io/github/stefanbratanov/chatjpt/ModerationsClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ModerationsClient.java index 56237c7..e1a8b9c 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ModerationsClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ModerationsClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.URI; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ModifyAssistantRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ModifyAssistantRequest.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/ModifyAssistantRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ModifyAssistantRequest.java index 0540d16..812be24 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ModifyAssistantRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ModifyAssistantRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ModifyMessageRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ModifyMessageRequest.java similarity index 94% rename from src/main/java/io/github/stefanbratanov/chatjpt/ModifyMessageRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ModifyMessageRequest.java index f0f86be..5f1af96 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ModifyMessageRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ModifyMessageRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.Map; import java.util.Optional; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ModifyRunRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ModifyRunRequest.java similarity index 94% rename from src/main/java/io/github/stefanbratanov/chatjpt/ModifyRunRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ModifyRunRequest.java index ea29a46..7f25341 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ModifyRunRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ModifyRunRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.Map; import java.util.Optional; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ModifyThreadRequest.java b/src/main/java/io/github/stefanbratanov/jvm/openai/ModifyThreadRequest.java similarity index 94% rename from src/main/java/io/github/stefanbratanov/chatjpt/ModifyThreadRequest.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/ModifyThreadRequest.java index 0774a98..e52af43 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ModifyThreadRequest.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/ModifyThreadRequest.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.util.Map; import java.util.Optional; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/MultipartBodyPublisher.java b/src/main/java/io/github/stefanbratanov/jvm/openai/MultipartBodyPublisher.java similarity index 98% rename from src/main/java/io/github/stefanbratanov/chatjpt/MultipartBodyPublisher.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/MultipartBodyPublisher.java index c7e5503..2818589 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/MultipartBodyPublisher.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/MultipartBodyPublisher.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/ChatJPT.java b/src/main/java/io/github/stefanbratanov/jvm/openai/OpenAI.java similarity index 96% rename from src/main/java/io/github/stefanbratanov/chatjpt/ChatJPT.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/OpenAI.java index f44ee58..82bee10 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/ChatJPT.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/OpenAI.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -14,7 +14,7 @@ * based on the endpoints defined at API * Reference - OpenAI API */ -public final class ChatJPT { +public final class OpenAI { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @@ -38,8 +38,7 @@ public final class ChatJPT { private final MessagesClient messagesClient; private final RunsClient runsClient; - private ChatJPT( - URI baseUrl, String apiKey, Optional organization, HttpClient httpClient) { + private OpenAI(URI baseUrl, String apiKey, Optional organization, HttpClient httpClient) { audioClient = new AudioClient(baseUrl, apiKey, organization, httpClient, OBJECT_MAPPER); chatClient = new ChatClient(baseUrl, apiKey, organization, httpClient, OBJECT_MAPPER); embeddingsClient = @@ -201,11 +200,11 @@ public Builder httpClient(HttpClient httpClient) { return this; } - public ChatJPT build() { + public OpenAI build() { if (!baseUrl.endsWith("/")) { baseUrl += "/"; } - return new ChatJPT( + return new OpenAI( URI.create(baseUrl), apiKey, organization, diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/OpenAIAssistantsClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIAssistantsClient.java similarity index 96% rename from src/main/java/io/github/stefanbratanov/chatjpt/OpenAIAssistantsClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIAssistantsClient.java index 80813d2..6cc45ff 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/OpenAIAssistantsClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIAssistantsClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.databind.ObjectMapper; import java.net.http.HttpClient; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/OpenAIClient.java b/src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIClient.java similarity index 99% rename from src/main/java/io/github/stefanbratanov/chatjpt/OpenAIClient.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIClient.java index 5474418..944530c 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/OpenAIClient.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIClient.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; diff --git a/src/main/java/io/github/stefanbratanov/chatjpt/OpenAIException.java b/src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIException.java similarity index 95% rename from src/main/java/io/github/stefanbratanov/chatjpt/OpenAIException.java rename to src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIException.java index 03e6616..e3fcc82 100644 --- a/src/main/java/io/github/stefanbratanov/chatjpt/OpenAIException.java +++ b/src/main/java/io/github/stefanbratanov/jvm/openai/OpenAIException.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; /** * Exceptions will be based on METADATA = Map.of("modified", "true", "user", "abc123"); @Test public void testThreadsClient() { - ThreadsClient threadsClient = chatJPT.threadsClient(); + ThreadsClient threadsClient = openAI.threadsClient(); CreateThreadRequest.Message message = CreateThreadRequest.Message.newBuilder() @@ -43,9 +43,9 @@ public void testThreadsClient() { @Test public void testMessagesClient() { - ThreadsClient threadsClient = chatJPT.threadsClient(); + ThreadsClient threadsClient = openAI.threadsClient(); - MessagesClient messagesClient = chatJPT.messagesClient(); + MessagesClient messagesClient = openAI.messagesClient(); // upload file UploadFileRequest uploadFileRequest = @@ -53,7 +53,7 @@ public void testMessagesClient() { .file(getTestResource("/mydata.jsonl")) .purpose("fine-tune") .build(); - File file = chatJPT.filesClient().uploadFile(uploadFileRequest); + File file = openAI.filesClient().uploadFile(uploadFileRequest); // create thread Thread thread = threadsClient.createThread(CreateThreadRequest.newBuilder().build()); @@ -94,7 +94,7 @@ public void testMessagesClient() { List messageFiles = paginatedMessageFiles.data(); - assertThat(messageFiles).hasSize(1); + Assertions.assertThat(messageFiles).hasSize(1); ThreadMessageFile messageFile = messageFiles.get(0); @@ -114,7 +114,7 @@ public void testMessagesClient() { @Test public void testAssistantsClient() { - AssistantsClient assistantsClient = chatJPT.assistantsClient(); + AssistantsClient assistantsClient = openAI.assistantsClient(); File file = uploadRealEstateAgentAssistantFile(); @@ -180,10 +180,10 @@ public void testAssistantsClient() { @Test public void testRunsClient() { - ThreadsClient threadsClient = chatJPT.threadsClient(); - AssistantsClient assistantsClient = chatJPT.assistantsClient(); + ThreadsClient threadsClient = openAI.threadsClient(); + AssistantsClient assistantsClient = openAI.assistantsClient(); - RunsClient runsClient = chatJPT.runsClient(); + RunsClient runsClient = openAI.runsClient(); // create thread CreateThreadRequest createThreadRequest = @@ -290,8 +290,11 @@ public void testRunsClient() { assertThrows( OpenAIException.class, () -> { - ToolOutput toolOutput = - ToolOutput.newBuilder().toolCallId("call_abc123").output("28C").build(); + SubmitToolOutputsRequest.ToolOutput toolOutput = + SubmitToolOutputsRequest.ToolOutput.newBuilder() + .toolCallId("call_abc123") + .output("28C") + .build(); runsClient.submitToolOutputs( thread.id(), run.id(), new SubmitToolOutputsRequest(List.of(toolOutput))); }); @@ -318,6 +321,6 @@ private File uploadRealEstateAgentAssistantFile() { .file(getTestResource("/real-estate-agent-assistant.txt")) .purpose("assistants") .build(); - return chatJPT.filesClient().uploadFile(uploadFileRequest); + return openAI.filesClient().uploadFile(uploadFileRequest); } } diff --git a/src/test/java/io/github/stefanbratanov/chatjpt/ChatJPTIntegrationTest.java b/src/test/java/io/github/stefanbratanov/jvm/openai/OpenAIIntegrationTest.java similarity index 86% rename from src/test/java/io/github/stefanbratanov/chatjpt/ChatJPTIntegrationTest.java rename to src/test/java/io/github/stefanbratanov/jvm/openai/OpenAIIntegrationTest.java index eed1402..328bf16 100644 --- a/src/test/java/io/github/stefanbratanov/chatjpt/ChatJPTIntegrationTest.java +++ b/src/test/java/io/github/stefanbratanov/jvm/openai/OpenAIIntegrationTest.java @@ -1,11 +1,9 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -import io.github.stefanbratanov.chatjpt.ChatMessage.UserMessage.UserMessageWithContentParts.ContentPart.TextContentPart; -import io.github.stefanbratanov.chatjpt.FineTuningClient.PaginatedFineTuningEvents; -import io.github.stefanbratanov.chatjpt.FineTuningClient.PaginatedFineTuningJobs; +import io.github.stefanbratanov.jvm.openai.ChatMessage.UserMessage.UserMessageWithContentParts.ContentPart.TextContentPart; import java.nio.file.Path; import java.time.Duration; import java.util.List; @@ -13,18 +11,19 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class ChatJPTIntegrationTest extends ChatJPTIntegrationTestBase { +public class OpenAIIntegrationTest extends OpenAIIntegrationTestBase { @Test public void testUnauthorizedRequest() { - ChatJPT unauthorizedChatJPT = ChatJPT.newBuilder("foobar").build(); + OpenAI unauthorizedOpenAI = OpenAI.newBuilder("foobar").build(); OpenAIException exception = - assertThrows(OpenAIException.class, () -> unauthorizedChatJPT.modelsClient().listModels()); + assertThrows(OpenAIException.class, () -> unauthorizedOpenAI.modelsClient().listModels()); assertThat(exception.statusCode()).isEqualTo(401); assertThat(exception.errorMessage()).startsWith("Incorrect API key provided: foobar"); @@ -32,7 +31,7 @@ public void testUnauthorizedRequest() { @Test public void testChatClient() { - ChatClient chatClient = chatJPT.chatClient(); + ChatClient chatClient = openAI.chatClient(); ChatRequest request = ChatRequest.newBuilder() @@ -71,11 +70,11 @@ public void testChatClient() { @Test public void testModelsClient() { - ModelsClient modelsClient = chatJPT.modelsClient(); + ModelsClient modelsClient = openAI.modelsClient(); List models = modelsClient.listModels(); - assertThat(models).isNotEmpty(); + Assertions.assertThat(models).isNotEmpty(); Model model = modelsClient.retrieveModel("gpt-3.5-turbo-instruct"); @@ -84,7 +83,7 @@ public void testModelsClient() { @Test public void testAudioClient(@TempDir Path tempDir) { - AudioClient audioClient = chatJPT.audioClient(); + AudioClient audioClient = openAI.audioClient(); SpeechRequest speechRequest = SpeechRequest.newBuilder() @@ -121,7 +120,7 @@ public void testAudioClient(@TempDir Path tempDir) { @Test @Disabled("Image models are costly") public void testImagesClient() { - ImagesClient imagesClient = chatJPT.imagesClient(); + ImagesClient imagesClient = openAI.imagesClient(); CreateImageRequest createImageRequest = CreateImageRequest.newBuilder() @@ -167,7 +166,7 @@ public void testImagesClient() { @Test public void testModerationsClient() { - ModerationsClient moderationsClient = chatJPT.moderationsClient(); + ModerationsClient moderationsClient = openAI.moderationsClient(); ModerationRequest request = ModerationRequest.newBuilder().input("I want to kill them.").build(); @@ -181,7 +180,7 @@ public void testModerationsClient() { @Test public void testEmbeddingsClient() { - EmbeddingsClient embeddingsClient = chatJPT.embeddingsClient(); + EmbeddingsClient embeddingsClient = openAI.embeddingsClient(); EmbeddingsRequest request = EmbeddingsRequest.newBuilder() @@ -198,7 +197,7 @@ public void testEmbeddingsClient() { @Test public void testFilesClient() { - FilesClient filesClient = chatJPT.filesClient(); + FilesClient filesClient = openAI.filesClient(); Path jsonlFile = getTestResource("/mydata.jsonl"); @@ -219,8 +218,8 @@ public void testFilesClient() { @Test @Disabled("Fine-tuning models are costly") public void testFineTuningClient() { - FilesClient filesClient = chatJPT.filesClient(); - FineTuningClient fineTuningClient = chatJPT.fineTuningClient(); + FilesClient filesClient = openAI.filesClient(); + FineTuningClient fineTuningClient = openAI.fineTuningClient(); Path trainingFile = getTestResource("/mydata.jsonl"); UploadFileRequest uploadFileRequest = @@ -238,7 +237,7 @@ public void testFineTuningClient() { assertThat(createdFineTuningJob).isNotNull(); - PaginatedFineTuningJobs fineTuningJobs = + FineTuningClient.PaginatedFineTuningJobs fineTuningJobs = fineTuningClient.listFineTuningJobs(Optional.empty(), Optional.empty()); assertThat(fineTuningJobs.hasMore()).isFalse(); @@ -246,7 +245,7 @@ public void testFineTuningClient() { .anySatisfy( fineTuningJob -> assertThat(fineTuningJob.id()).isEqualTo(createdFineTuningJob.id())); - PaginatedFineTuningEvents fineTuningJobEvents = + FineTuningClient.PaginatedFineTuningEvents fineTuningJobEvents = fineTuningClient.listFineTuningJobEvents( createdFineTuningJob.id(), Optional.empty(), Optional.empty()); diff --git a/src/test/java/io/github/stefanbratanov/chatjpt/ChatJPTIntegrationTestBase.java b/src/test/java/io/github/stefanbratanov/jvm/openai/OpenAIIntegrationTestBase.java similarity index 86% rename from src/test/java/io/github/stefanbratanov/chatjpt/ChatJPTIntegrationTestBase.java rename to src/test/java/io/github/stefanbratanov/jvm/openai/OpenAIIntegrationTestBase.java index 7b06d5a..d549694 100644 --- a/src/test/java/io/github/stefanbratanov/chatjpt/ChatJPTIntegrationTestBase.java +++ b/src/test/java/io/github/stefanbratanov/jvm/openai/OpenAIIntegrationTestBase.java @@ -1,4 +1,4 @@ -package io.github.stefanbratanov.chatjpt; +package io.github.stefanbratanov.jvm.openai; import static org.assertj.core.api.Assertions.assertThat; @@ -13,20 +13,20 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; -public class ChatJPTIntegrationTestBase { +public class OpenAIIntegrationTestBase { - protected static ChatJPT chatJPT; + protected static OpenAI openAI; @BeforeAll public static void setUp() { String apiKey = System.getenv("OPENAI_API_KEY"); - chatJPT = ChatJPT.newBuilder(apiKey).build(); + openAI = OpenAI.newBuilder(apiKey).build(); } @AfterAll public static void cleanUp() { // Cleanup of files uploads - FilesClient filesClient = chatJPT.filesClient(); + FilesClient filesClient = openAI.filesClient(); filesClient .listFiles() .forEach( @@ -45,7 +45,7 @@ public static void cleanUp() { protected Path getTestResource(String resource) { try { return Paths.get( - Objects.requireNonNull(ChatJPTIntegrationTestBase.class.getResource(resource)).toURI()); + Objects.requireNonNull(OpenAIIntegrationTestBase.class.getResource(resource)).toURI()); } catch (URISyntaxException ex) { throw new RuntimeException(ex); }