-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(FIM): legacy completions api supported for FIM
- refactor chat api name for better distinguish with legacy completions api
- Loading branch information
Showing
28 changed files
with
595 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
...i-client-core/src/commonMain/kotlin/com/tddworks/openai/api/chat/api/StreamableRequest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...t-core/src/commonMain/kotlin/com/tddworks/openai/api/legacy/completions/api/Completion.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.tddworks.openai.api.legacy.completions.api | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class Completion( | ||
val id: String, | ||
val choices: List<CompletionChoice>, | ||
val created: Int, | ||
val model: String, | ||
@SerialName("system_fingerprint") | ||
val systemFingerprint: String?, | ||
val `object`: String?, | ||
val usage: Usage? | ||
) { | ||
companion object { | ||
fun dummy() = Completion( | ||
id = "id", | ||
choices = emptyList(), | ||
created = 0, | ||
model = "model", | ||
systemFingerprint = "systemFingerprint", | ||
`object` = "object", | ||
usage = Usage() | ||
) | ||
} | ||
} | ||
|
||
@Serializable | ||
data class CompletionChoice( | ||
@SerialName("text") | ||
val text: String, | ||
@SerialName("index") | ||
val index: Int, | ||
@SerialName("logprobs") | ||
val logprobs: Map<String, String>?, | ||
@SerialName("finish_reason") | ||
val finishReason: String | ||
) | ||
|
||
@Serializable | ||
data class Usage( | ||
@SerialName("prompt_tokens") | ||
val promptTokens: Int? = null, | ||
@SerialName("completion_tokens") | ||
val completionTokens: Int? = null, | ||
@SerialName("total_tokens") | ||
val totalTokens: Int? = null, | ||
) |
Oops, something went wrong.