-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d870f9
commit 036bd79
Showing
7 changed files
with
149 additions
and
5 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
1 change: 0 additions & 1 deletion
1
openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ChatCompletion.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
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
17 changes: 17 additions & 0 deletions
17
openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/Logprobs.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,17 @@ | ||
package com.aallam.openai.api.chat | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* An object containing log probability information for the choice. | ||
* | ||
* [documentation](https://platform.openai.com/docs/api-reference/chat/object) | ||
*/ | ||
@Serializable | ||
public data class Logprobs( | ||
/** | ||
* A list of message content tokens with log probability information. | ||
*/ | ||
@SerialName("content") public val content: List<LogprobsContent>? = null, | ||
) |
33 changes: 33 additions & 0 deletions
33
openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/LogprobsContent.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,33 @@ | ||
package com.aallam.openai.api.chat | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* An object containing logprobs for a single token | ||
* | ||
* [documentation](https://platform.openai.com/docs/api-reference/chat/object) | ||
*/ | ||
@Serializable | ||
public data class LogprobsContent( | ||
/** | ||
* The token. | ||
*/ | ||
@SerialName("token") public val token: String, | ||
/** | ||
* The log probability of this token, if it is within the top 20 most likely tokens. | ||
* Otherwise, the value -9999.0 is used to signify that the token is very unlikely. | ||
*/ | ||
@SerialName("logprob") public val logprob: Double, | ||
/** | ||
* A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where | ||
* characters are represented by multiple tokens and their byte representations must be combined to generate | ||
* the correct text representation. Can be `null` if there is no bytes representation for the token. | ||
*/ | ||
@SerialName("bytes") public val bytes: List<Int>? = null, | ||
/** | ||
* List of the most likely tokens and their log probability, at this token position. | ||
* In rare cases, there may be fewer than the number of requested top_logprobs returned. | ||
*/ | ||
@SerialName("top_logprobs") public val topLogprobs: List<TopLogprob>, | ||
) |
28 changes: 28 additions & 0 deletions
28
openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/TopLogprob.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,28 @@ | ||
package com.aallam.openai.api.chat | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* An object containing a token and their log probability. | ||
* | ||
* [documentation](https://platform.openai.com/docs/api-reference/chat/object) | ||
*/ | ||
@Serializable | ||
public data class TopLogprob( | ||
/** | ||
* The token | ||
*/ | ||
@SerialName("token") public val token: String, | ||
/** | ||
* The log probability of this token, if it is within the top 20 most likely tokens. | ||
* Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. | ||
*/ | ||
@SerialName("logprob") public val logprob: Double, | ||
/** | ||
* A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where | ||
* characters are represented by multiple tokens and their byte representations must be combined to generate | ||
* the correct text representation. Can be `null` if there is no bytes representation for the token. | ||
*/ | ||
@SerialName("bytes") public val bytes: List<Int>? = null, | ||
) |