Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: MissingFieldException: Fields [name, arguments] in ToolCallStep$FunctionTool #271

Merged
merged 3 commits into from
Nov 25, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public sealed interface ToolCallStep {
/**
* The ID of the tool call.
*/
@SerialName("id") public val id: String,
@SerialName("id") public val id: ToolCallStepId,
/**
* The Code Interpreter tool call definition.
*/
Expand All @@ -77,7 +77,7 @@ public sealed interface ToolCallStep {
/**
* The ID of the tool call object.
*/
@SerialName("id") public val id: String,
@SerialName("id") public val id: ToolCallStepId,
/**
* For now, this is always going to be an empty object.
*/
Expand All @@ -89,21 +89,30 @@ public sealed interface ToolCallStep {
@SerialName("function")
public data class FunctionTool(
/**
* The name of the function.
*/
@SerialName("name") public val name: String,
/**
* The arguments passed to the function.
* The ID of the tool call object.
*/
@SerialName("arguments") public val arguments: String,

@SerialName("id") public val id: ToolCallStepId,
/**
* The output of the function. This will be null if the outputs have not been submitted yet.
* The definition of the function that was called.
*/
@SerialName("output") public val output: String? = null,
@SerialName("function") public val function: FunctionToolCallStep,
) : ToolCallStep
}

@BetaOpenAI
@Serializable
public data class FunctionToolCallStep (
/**
* The arguments passed to the function.
*/
@SerialName("arguments") public val arguments: String,

/**
* The output of the function. This will be null if the outputs have not been submitted yet.
*/
@SerialName("output") public val output: String? = null,
)

@BetaOpenAI
@Serializable
public data class CodeInterpreterToolCall(
Expand All @@ -117,7 +126,6 @@ public data class CodeInterpreterToolCall(
* (logs) or images (image). Each of these is represented by a different object type.
*/
val outputs: List<CodeInterpreterToolCallOutput>

)

@BetaOpenAI
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.aallam.openai.api.run

import com.aallam.openai.api.BetaOpenAI
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmInline

/**
* Tool call step identifier.
*/
@BetaOpenAI
@JvmInline
@Serializable
public value class ToolCallStepId(public val id: String)
Loading