Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal object Constants {
internal const val OPENAI_TOKEN = "{OPENAI_KEY}"

/** Chat model: "gpt-4-32k" or "gpt-3.5-turbo-16k" */
internal const val OPENAI_CHAT_MODEL = "gpt-3.5-turbo-16k" // 4096 tokens for Sliding Window testing
internal const val OPENAI_CHAT_MODEL = "gpt-4-1106-preview" // 4096 tokens for Sliding Window testing

/** Tokenizer model: GPT_4_32K or GPT_3_5_TURBO_16K */
internal val OPENAI_CHAT_TOKENIZER_MODEL = ModelType.GPT_3_5_TURBO_16K // to match above
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class DocumentChatWrapper(val context: Context?) {
* rendered from the URL (no bytes returned from API)
* @return image URL or empty string */
suspend fun imageURL(prompt: String): String {
val imageRequest = ImageCreation(prompt)
val imageRequest = ImageCreation(prompt = prompt, model = ModelId("dall-e-3"))

// OpenAI network request
val images: List<ImageURL> = openAI.imageURL(imageRequest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class DroidconEmbeddingsWrapper(val context: Context?) {
* rendered from the URL (no bytes returned from API)
* @return image URL or empty string */
suspend fun imageURL(prompt: String): String {
val imageRequest = ImageCreation(prompt)
val imageRequest = ImageCreation(prompt = prompt, model = ModelId("dall-e-3"))

// OpenAI network request
val images: List<ImageURL> = openAI.imageURL(imageRequest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class OpenAIWrapper(val context: Context?) {
}

suspend fun imageURL(prompt: String): String {
val imageRequest = ImageCreation(prompt)
val imageRequest = ImageCreation(prompt = prompt, model = ModelId("dall-e-3"))

// OpenAI network request
val images: List<ImageURL> = openAI.imageURL(imageRequest)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.compose.jetchat.data

import android.util.Log
import com.aallam.openai.api.LegacyOpenAI
import com.aallam.openai.api.chat.ChatCompletion
import com.aallam.openai.api.chat.chatCompletionRequest
import com.aallam.openai.api.completion.TextCompletion
Expand All @@ -19,6 +20,7 @@ class SummarizeHistory {
* Use the OpenAI completion endpoint to summarize the
* conversation history into a topic-dense string
*/
@OptIn(LegacyOpenAI::class)
suspend fun summarize(history: String): String {
if (history.isNullOrEmpty()) return ""

Expand Down
4 changes: 2 additions & 2 deletions Jetchat/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#####
[versions]
accompanist = "0.28.0"
androidGradlePlugin = "8.0.2"
androidGradlePlugin = "8.1.2"
androidx-activity-compose = "1.7.0"
androidx-appcompat = "1.6.1"
androidx-benchmark = "1.1.0"
Expand Down Expand Up @@ -122,7 +122,7 @@ kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-t
ktor-client-okhttp = "io.ktor:ktor-client-okhttp:2.3.0"
okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
okhttp3 = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
openai = "com.aallam.openai:openai-client:3.3.1"
openai = "com.aallam.openai:openai-client:3.6.0-SNAPSHOT"
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
rometools-modules = { module = "com.rometools:rome-modules", version.ref = "rome" }
rometools-rome = { module = "com.rometools:rome", version.ref = "rome" }
Expand Down
3 changes: 3 additions & 0 deletions Jetchat/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ dependencyResolutionManagement {

google()
mavenCentral()

// for aallam latest OpenAI stuff
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
}
}
rootProject.name = "Jetchat"
Expand Down