Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.violabs:chappy:1.1.9'
}
dependencies {
implementation("com.github.violabs:chappy:1.1.9")
}
<dependency>
<groupId>com.github.violabs</groupId>
<artifactId>chappy</artifactId>
<version>1.1.9</version>
</dependency>
libraryDependencies += "com.github.violabs" % "chappy" % "1.1.9"
:dependencies [[com.github.violabs/chappy "1.1.9"]]
Chappy is a small Kotlin library that provides simple conversion objects for Open AI API while utilizing the kotlinx.serialization library. It allows for snake case to come in from Open AI API and go out to Open AI, but does not affect any other use.
Please note that this library is in constant development and should be used with caution.
You can install Chappy via Gradle or Maven by adding the following dependency:
Gradle:
repositories {
mavenCentral()
maven(url = "https://jitpack.io")
}
implementation('com.github.violabs:chappy:<version>')
You can utilize the Request
to send to Open AI and you may use the Response
to encapsulate it.
Completion.Request(
prompt = "test",
model = "text-davinci-003",
temperature = 0.0,
maxTokens = 7,
topP = 1.0,
numberOfChoices = 1,
stream = false,
stop = "\n"
)
Completion.Response(
id = "1",
objectType = "testing",
model = "text-davinci-003",
created = 123455678,
choices = setOf(
Completion.Choice(
text = "Hello",
index = 1,
logprobs = null,
finishResponse = "limit"
)
),
usage = OpenAi.Usage(
promptTokens = 1,
completionTokens = 2,
totalTokens = 3
)
)
Chat.Request(
messages = listOf(
Chat.Message("Hello")
)
)
Chat.Response(
id = "1",
objectType = "testing",
model = "gpt-3.5-turbo",
created = 123455678,
choices = setOf(
Chat.Choice(
index = 1,
message = Chat.Message("Hello", Chat.Role.ASSISTANT),
finishResponse = "limit"
)
),
usage = usage = OpenAi.Usage(
promptTokens = 1,
completionTokens = 2,
totalTokens = 3
)
)
Chappy is currently in early development and is subject to change. We welcome contributions from the community and encourage you to open an issue or pull request on our GitHub repository if you encounter any issues or have any feedback.
Chappy is released under the MIT License.