Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
### Added
- **chat**: add reasoning effort, max completion tokens, store options for reasoning model support (#415) (thanks @Taewan-P)

### Added
- **chat**: feat(chat): add reasoningContent support for both ChatMessage and ChatDelta

## 4.0.0
> Published 01 Feb 2025

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public data class ChatDelta(
*/
@SerialName("content") val content: String? = null,

/**
* The reasoning contents of the message.
*/
@SerialName("reasoning_content") val reasoningContent: String? = null,

/**
* The name and arguments of a function that should be called, as generated by the model.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public data class ChatMessage(
*/
@SerialName("content") public val messageContent: Content? = null,

/**
* The model's reasoning content, providing intermediate logical steps or justification for the response.
* This field is typically populated by advanced models supporting reasoning transparency.
*/
@SerialName("reasoning_content") public val messageReasoningContent: Content? = null,

/**
* The author's name of this message.
* [name] is required if the role is `[ChatRole.Function], and it should be the name of the function whose response is
Expand Down Expand Up @@ -103,6 +109,12 @@ public data class ChatMessage(
else -> error("Content is not text")
}

val reasoningContent: String?
get() = when (messageReasoningContent) {
is TextContent? -> messageReasoningContent?.content
else -> error("Content is not text")
}

@Suppress("FunctionName")
public companion object {

Expand Down