Tool

@Serializable
class Tool(val type: ToolCallType, val function: FunctionRequest)

Declaration of a tool the model may call during a chat completion.

The DeepSeek API currently supports function tools only; provide the schema via FunctionRequest.parameters so the model can emit matching arguments.

Example:

val weather = Tool(
type = ToolCallType.FUNCTION,
function = FunctionRequest(
name = "get_weather",
description = "Get the current weather for a city",
parameters = buildJsonObject {
put("type", "object")
putJsonObject("properties") {
putJsonObject("city") { put("type", "string") }
}
putJsonArray("required") { add("city") }
},
),
)

Constructors

Link copied to clipboard
constructor(type: ToolCallType, function: FunctionRequest)

Properties

Link copied to clipboard

Function signature the model can call.

Link copied to clipboard

Tool type discriminator; currently always ToolCallType.FUNCTION.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String