conversationClient

abstract fun conversationClient(conversationId: UUID = UUID.randomUUID()): ConversationClient

Returns a ConversationClient for interacting with a specific conversation.

If a conversationId for an existing conversation is provided, the returned client operates on that conversation. If omitted, a new random UUID is generated which can be used to create a new conversation.

Return

A ConversationClient bound to the specified conversation.

Parameters

conversationId

The unique identifier of the conversation. Defaults to a new random UUID.

Samples

// Fetch recent conversations and use the latest if one exists,
// otherwise generate a new UUID for a new conversation
val result = coreClient.conversations(limit = 10, forceRefresh = true)
val conversationId = if (result is Result.Success) {
    result.data.firstOrNull()?.identifier ?: UUID.randomUUID()
} else {
    UUID.randomUUID()
}
val conversationClient = coreClient.conversationClient(conversationId)