chatCatching

Sends a chat request and wraps the result in a Result.

Return

A Result with either a ChatResponse or the captured exception.

Parameters

chat

A fully configured ChatRequest.

See also


inline suspend fun ChatClient.chatCatching(noinline request: ChatRequestBuilder.() -> Unit): Result<ChatResponse>

Sends a chat request using the request DSL and wraps the result in a Result.

Return

A Result with either a ChatResponse or the captured exception.

Parameters

request

DSL builder for configuring the full request.

See also


inline suspend fun ChatClient.chatCatching(model: String, noinline chat: ChatBuilder.() -> Unit): Result<ChatResponse>

Sends a chat request using the message DSL and wraps the result in a Result.

Return

A Result with either a ChatResponse or the captured exception.

Parameters

model

The name of the AI model to use.

chat

DSL builder for constructing chat messages.

See also