Skip to content

Commit

Permalink
feat(client): add more builder convenience methods for lists (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 8, 2025
1 parent ce5c780 commit 8b94421
Show file tree
Hide file tree
Showing 17 changed files with 529 additions and 0 deletions.
21 changes: 21 additions & 0 deletions openai-java-core/src/main/kotlin/com/openai/models/Assistant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,27 @@ private constructor(
}
}

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(fileSearchTool: FileSearchTool) =
addTool(AssistantTool.ofFileSearchTool(fileSearchTool))

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(functionTool: FunctionTool) =
addTool(AssistantTool.ofFunctionTool(functionTool))

/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), [GPT-4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,27 @@ constructor(
}
}

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(fileSearchTool: FileSearchTool) =
addTool(AssistantTool.ofFileSearchTool(fileSearchTool))

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(functionTool: FunctionTool) =
addTool(AssistantTool.ofFunctionTool(functionTool))

/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only
Expand Down Expand Up @@ -1041,6 +1062,26 @@ constructor(
*/
fun addTool(tool: AssistantTool) = apply { body.addTool(tool) }

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
body.addTool(codeInterpreterTool)
}

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }

/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,27 @@ constructor(
}
}

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(fileSearchTool: FileSearchTool) =
addTool(AssistantTool.ofFileSearchTool(fileSearchTool))

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(functionTool: FunctionTool) =
addTool(AssistantTool.ofFunctionTool(functionTool))

/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only
Expand Down Expand Up @@ -1039,6 +1060,26 @@ constructor(
*/
fun addTool(tool: AssistantTool) = apply { body.addTool(tool) }

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
body.addTool(codeInterpreterTool)
}

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }

/**
* A list of tool enabled on the assistant. There can be a maximum of 128 tools per
* assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`.
*/
fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }

/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,26 @@ constructor(
}
}

/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))

/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
fun addTool(fileSearchTool: FileSearchTool) =
addTool(Tool.ofFileSearchTool(fileSearchTool))

/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
fun addTool(functionTool: FunctionTool) = addTool(Tool.ofFunctionTool(functionTool))

/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only
Expand Down Expand Up @@ -1608,6 +1628,26 @@ constructor(
*/
fun addTool(tool: Tool) = apply { body.addTool(tool) }

/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
body.addTool(codeInterpreterTool)
}

/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }

/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }

/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
Expand Down Expand Up @@ -2476,6 +2516,14 @@ constructor(
}
}

/** The tools to add this file to. */
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))

/** The tools to add this file to. */
fun addTool(fileSearch: Tool.FileSearch) =
addTool(Tool.ofFileSearch(fileSearch))

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,13 @@ constructor(
}
}

/** The tools to add this file to. */
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))

/** The tools to add this file to. */
fun addTool(fileSearch: Tool.FileSearch) = addTool(Tool.ofFileSearch(fileSearch))

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,13 @@ constructor(
}
}

/** The tools to add this file to. */
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))

/** The tools to add this file to. */
fun addTool(fileSearch: Tool.FileSearch) = addTool(Tool.ofFileSearch(fileSearch))

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,27 @@ constructor(
}
}

/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(AssistantTool.ofCodeInterpreterTool(codeInterpreterTool))

/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
fun addTool(fileSearchTool: FileSearchTool) =
addTool(AssistantTool.ofFileSearchTool(fileSearchTool))

/**
* Override the tools the assistant can use for this run. This is useful for modifying
* the behavior on a per-run basis.
*/
fun addTool(functionTool: FunctionTool) =
addTool(AssistantTool.ofFunctionTool(functionTool))

/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only
Expand Down Expand Up @@ -1724,6 +1745,26 @@ constructor(
*/
fun addTool(tool: AssistantTool) = apply { body.addTool(tool) }

/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
fun addTool(codeInterpreterTool: CodeInterpreterTool) = apply {
body.addTool(codeInterpreterTool)
}

/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
fun addTool(fileSearchTool: FileSearchTool) = apply { body.addTool(fileSearchTool) }

/**
* Override the tools the assistant can use for this run. This is useful for modifying the
* behavior on a per-run basis.
*/
fun addTool(functionTool: FunctionTool) = apply { body.addTool(functionTool) }

/**
* An alternative to sampling with temperature, called nucleus sampling, where the model
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
Expand Down Expand Up @@ -2387,6 +2428,13 @@ constructor(
}
}

/** The tools to add this file to. */
fun addTool(codeInterpreterTool: CodeInterpreterTool) =
addTool(Tool.ofCodeInterpreterTool(codeInterpreterTool))

/** The tools to add this file to. */
fun addTool(fileSearch: Tool.FileSearch) = addTool(Tool.ofFileSearch(fileSearch))

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
Expand Down
Loading

0 comments on commit 8b94421

Please sign in to comment.