diff --git a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/Tool.kt b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/Tool.kt index 25da1251..aaaa24e7 100644 --- a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/Tool.kt +++ b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/Tool.kt @@ -15,11 +15,6 @@ public data class Tool( */ @SerialName("type") val type: ToolType, - /** - * Tool description. - */ - @SerialName("description") val description: String? = null, - /** * A description of what the function does, used by the model to choose when and how to call the function. */ @@ -38,8 +33,7 @@ public data class Tool( public fun function(name: String, description: String? = null, parameters: Parameters): Tool = Tool( type = ToolType.Function, - description = description, - function = FunctionTool(name = name, parameters = parameters) + function = FunctionTool(name = name, description = description, parameters = parameters) ) } } @@ -56,12 +50,17 @@ public data class FunctionTool( @SerialName("name") val name: String, /** - * The parameters the function accepts, described as a JSON Schema object. - * See the [guide](https://github.com/aallam/openai-kotlin/blob/main/guides/ChatToolCalls.md) for examples, - * and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about + * The parameters the functions accept, described as a JSON Schema object. + * See the [guide](https://platform.openai.com/docs/guides/text-generation/function-calling) for examples, + * and the [JSON Schema reference](https://json-schema.org/understanding-json-schema) for documentation about * the format. * - * To describe a function that accepts no parameters, provide [Parameters.Empty]`. + * Omitting `parameters` defines a function with an empty parameter list. + */ + @SerialName("parameters") val parameters: Parameters? = null, + + /** + * A description of what the function does, used by the model to choose when and how to call the function. */ - @SerialName("parameters") val parameters: Parameters + @SerialName("description") public val description: String? = null ) diff --git a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/finetuning/ErrorInfo.kt b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/finetuning/ErrorInfo.kt index 49a0f0f9..91a6393e 100644 --- a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/finetuning/ErrorInfo.kt +++ b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/finetuning/ErrorInfo.kt @@ -11,12 +11,12 @@ public data class ErrorInfo( /** * A human-readable error message. */ - val message: String, + val message: String? = null, /** * A machine-readable error code. */ - val code: String, + val code: String? = null, /** * The parameter that was invalid (e.g., `training_file`, `validation_file`), or null if not parameter-specific.