Class ThreadCreateAndRunParams.Body.Builder
-
- All Implemented Interfaces:
public final class ThreadCreateAndRunParams.Body.Builder
A builder for Body.
-
-
Method Summary
-
-
Method Detail
-
assistantId
final ThreadCreateAndRunParams.Body.Builder assistantId(String assistantId)
The ID of the assistant to use to execute this run.
-
assistantId
final ThreadCreateAndRunParams.Body.Builder assistantId(JsonField<String> assistantId)
Sets Builder.assistantId to an arbitrary JSON value.
You should usually call Builder.assistantId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
instructions
final ThreadCreateAndRunParams.Body.Builder instructions(String instructions)
Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis.
-
instructions
final ThreadCreateAndRunParams.Body.Builder instructions(Optional<String> instructions)
Alias for calling Builder.instructions with
instructions.orElse(null)
.
-
instructions
final ThreadCreateAndRunParams.Body.Builder instructions(JsonField<String> instructions)
Sets Builder.instructions to an arbitrary JSON value.
You should usually call Builder.instructions with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
maxCompletionTokens
final ThreadCreateAndRunParams.Body.Builder maxCompletionTokens(Long maxCompletionTokens)
The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status
incomplete
. Seeincomplete_details
for more info.
-
maxCompletionTokens
final ThreadCreateAndRunParams.Body.Builder maxCompletionTokens(Long maxCompletionTokens)
Alias for Builder.maxCompletionTokens.
This unboxed primitive overload exists for backwards compatibility.
-
maxCompletionTokens
final ThreadCreateAndRunParams.Body.Builder maxCompletionTokens(Optional<Long> maxCompletionTokens)
Alias for calling Builder.maxCompletionTokens with
maxCompletionTokens.orElse(null)
.
-
maxCompletionTokens
final ThreadCreateAndRunParams.Body.Builder maxCompletionTokens(JsonField<Long> maxCompletionTokens)
Sets Builder.maxCompletionTokens to an arbitrary JSON value.
You should usually call Builder.maxCompletionTokens with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
maxPromptTokens
final ThreadCreateAndRunParams.Body.Builder maxPromptTokens(Long maxPromptTokens)
The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status
incomplete
. Seeincomplete_details
for more info.
-
maxPromptTokens
final ThreadCreateAndRunParams.Body.Builder maxPromptTokens(Long maxPromptTokens)
Alias for Builder.maxPromptTokens.
This unboxed primitive overload exists for backwards compatibility.
-
maxPromptTokens
final ThreadCreateAndRunParams.Body.Builder maxPromptTokens(Optional<Long> maxPromptTokens)
Alias for calling Builder.maxPromptTokens with
maxPromptTokens.orElse(null)
.
-
maxPromptTokens
final ThreadCreateAndRunParams.Body.Builder maxPromptTokens(JsonField<Long> maxPromptTokens)
Sets Builder.maxPromptTokens to an arbitrary JSON value.
You should usually call Builder.maxPromptTokens with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
metadata
final ThreadCreateAndRunParams.Body.Builder metadata(ThreadCreateAndRunParams.Metadata metadata)
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
metadata
final ThreadCreateAndRunParams.Body.Builder metadata(Optional<ThreadCreateAndRunParams.Metadata> metadata)
Alias for calling Builder.metadata with
metadata.orElse(null)
.
-
metadata
final ThreadCreateAndRunParams.Body.Builder metadata(JsonField<ThreadCreateAndRunParams.Metadata> metadata)
Sets Builder.metadata to an arbitrary JSON value.
You should usually call Builder.metadata with a well-typed Metadata value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final ThreadCreateAndRunParams.Body.Builder model(ChatModel model)
The ID of the Model to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used.
-
model
final ThreadCreateAndRunParams.Body.Builder model(Optional<ChatModel> model)
Alias for calling Builder.model with
model.orElse(null)
.
-
model
final ThreadCreateAndRunParams.Body.Builder model(JsonField<ChatModel> model)
Sets Builder.model to an arbitrary JSON value.
You should usually call Builder.model with a well-typed ChatModel value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final ThreadCreateAndRunParams.Body.Builder model(String value)
Sets model to an arbitrary String.
You should usually call model with a well-typed ChatModel constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
parallelToolCalls
final ThreadCreateAndRunParams.Body.Builder parallelToolCalls(Boolean parallelToolCalls)
Whether to enable parallel function calling during tool use.
-
parallelToolCalls
final ThreadCreateAndRunParams.Body.Builder parallelToolCalls(JsonField<Boolean> parallelToolCalls)
Sets Builder.parallelToolCalls to an arbitrary JSON value.
You should usually call Builder.parallelToolCalls with a well-typed Boolean value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
responseFormat
final ThreadCreateAndRunParams.Body.Builder responseFormat(AssistantResponseFormatOption responseFormat)
Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 * Turbo, and all GPT-3.5 Turbo models since
gpt-3.5-turbo-1106
.Setting to
{ "type": "json_schema", "json_schema": {...} }
enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.Setting to
{ "type": "json_object" }
enables JSON mode, which ensures the message the model generates is valid JSON.Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if
finish_reason="length"
, which indicates the generation exceededmax_tokens
or the conversation exceeded the max context length.
-
responseFormat
final ThreadCreateAndRunParams.Body.Builder responseFormat(Optional<AssistantResponseFormatOption> responseFormat)
Alias for calling Builder.responseFormat with
responseFormat.orElse(null)
.
-
responseFormat
final ThreadCreateAndRunParams.Body.Builder responseFormat(JsonField<AssistantResponseFormatOption> responseFormat)
Sets Builder.responseFormat to an arbitrary JSON value.
You should usually call Builder.responseFormat with a well-typed AssistantResponseFormatOption value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
responseFormat
final ThreadCreateAndRunParams.Body.Builder responseFormat(ResponseFormatText responseFormatText)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatText(responseFormatText)
.
-
responseFormat
final ThreadCreateAndRunParams.Body.Builder responseFormat(ResponseFormatJsonObject responseFormatJsonObject)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatJsonObject(responseFormatJsonObject)
.
-
responseFormat
final ThreadCreateAndRunParams.Body.Builder responseFormat(ResponseFormatJsonSchema responseFormatJsonSchema)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatJsonSchema(responseFormatJsonSchema)
.
-
responseFormatAuto
final ThreadCreateAndRunParams.Body.Builder responseFormatAuto()
Alias for calling responseFormat with
AssistantResponseFormatOption.ofAuto()
.
-
temperature
final ThreadCreateAndRunParams.Body.Builder temperature(Double temperature)
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
-
temperature
final ThreadCreateAndRunParams.Body.Builder temperature(Double temperature)
Alias for Builder.temperature.
This unboxed primitive overload exists for backwards compatibility.
-
temperature
final ThreadCreateAndRunParams.Body.Builder temperature(Optional<Double> temperature)
Alias for calling Builder.temperature with
temperature.orElse(null)
.
-
temperature
final ThreadCreateAndRunParams.Body.Builder temperature(JsonField<Double> temperature)
Sets Builder.temperature to an arbitrary JSON value.
You should usually call Builder.temperature with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
thread
final ThreadCreateAndRunParams.Body.Builder thread(ThreadCreateAndRunParams.Thread thread)
Options to create a new thread. If no thread is provided when running a request, an empty thread will be created.
-
thread
final ThreadCreateAndRunParams.Body.Builder thread(JsonField<ThreadCreateAndRunParams.Thread> thread)
Sets Builder.thread to an arbitrary JSON value.
You should usually call Builder.thread with a well-typed Thread value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
toolChoice
final ThreadCreateAndRunParams.Body.Builder toolChoice(AssistantToolChoiceOption toolChoice)
Controls which (if any) tool is called by the model.
none
means the model will not call any tools and instead generates a message.auto
is the default value and means the model can pick between generating a message or calling one or more tools.required
means the model must call one or more tools before responding to the user. Specifying a particular tool like{"type": "file_search"}
or{"type": "function", "function": {"name": "my_function"}}
forces the model to call that tool.
-
toolChoice
final ThreadCreateAndRunParams.Body.Builder toolChoice(Optional<AssistantToolChoiceOption> toolChoice)
Alias for calling Builder.toolChoice with
toolChoice.orElse(null)
.
-
toolChoice
final ThreadCreateAndRunParams.Body.Builder toolChoice(JsonField<AssistantToolChoiceOption> toolChoice)
Sets Builder.toolChoice to an arbitrary JSON value.
You should usually call Builder.toolChoice with a well-typed AssistantToolChoiceOption value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
toolChoice
final ThreadCreateAndRunParams.Body.Builder toolChoice(AssistantToolChoiceOption.Auto auto)
Alias for calling toolChoice with
AssistantToolChoiceOption.ofAuto(auto)
.
-
toolChoice
final ThreadCreateAndRunParams.Body.Builder toolChoice(AssistantToolChoice assistantToolChoice)
Alias for calling toolChoice with
AssistantToolChoiceOption.ofAssistantToolChoice(assistantToolChoice)
.
-
toolResources
final ThreadCreateAndRunParams.Body.Builder toolResources(ThreadCreateAndRunParams.ToolResources toolResources)
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the
code_interpreter
tool requires a list of file IDs, while thefile_search
tool requires a list of vector store IDs.
-
toolResources
final ThreadCreateAndRunParams.Body.Builder toolResources(Optional<ThreadCreateAndRunParams.ToolResources> toolResources)
Alias for calling Builder.toolResources with
toolResources.orElse(null)
.
-
toolResources
final ThreadCreateAndRunParams.Body.Builder toolResources(JsonField<ThreadCreateAndRunParams.ToolResources> toolResources)
Sets Builder.toolResources to an arbitrary JSON value.
You should usually call Builder.toolResources with a well-typed ToolResources value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
tools
final ThreadCreateAndRunParams.Body.Builder tools(List<ThreadCreateAndRunParams.Tool> tools)
Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis.
-
tools
final ThreadCreateAndRunParams.Body.Builder tools(Optional<List<ThreadCreateAndRunParams.Tool>> tools)
Alias for calling Builder.tools with
tools.orElse(null)
.
-
tools
final ThreadCreateAndRunParams.Body.Builder tools(JsonField<List<ThreadCreateAndRunParams.Tool>> tools)
Sets Builder.tools to an arbitrary JSON value.
You should usually call Builder.tools with a well-typed
List<Tool>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addTool
final ThreadCreateAndRunParams.Body.Builder addTool(ThreadCreateAndRunParams.Tool tool)
-
addTool
final ThreadCreateAndRunParams.Body.Builder addTool(CodeInterpreterTool codeInterpreter)
Alias for calling addTool with
Tool.ofCodeInterpreter(codeInterpreter)
.
-
addTool
final ThreadCreateAndRunParams.Body.Builder addTool(FileSearchTool fileSearch)
Alias for calling addTool with
Tool.ofFileSearch(fileSearch)
.
-
addTool
final ThreadCreateAndRunParams.Body.Builder addTool(FunctionTool function)
Alias for calling addTool with
Tool.ofFunction(function)
.
-
topP
final ThreadCreateAndRunParams.Body.Builder topP(Double topP)
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 tokens comprising the top 10% probability mass are considered.
We generally recommend altering this or temperature but not both.
-
topP
final ThreadCreateAndRunParams.Body.Builder topP(Double topP)
Alias for Builder.topP.
This unboxed primitive overload exists for backwards compatibility.
-
topP
final ThreadCreateAndRunParams.Body.Builder topP(Optional<Double> topP)
Alias for calling Builder.topP with
topP.orElse(null)
.
-
topP
final ThreadCreateAndRunParams.Body.Builder topP(JsonField<Double> topP)
Sets Builder.topP to an arbitrary JSON value.
You should usually call Builder.topP with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
truncationStrategy
final ThreadCreateAndRunParams.Body.Builder truncationStrategy(ThreadCreateAndRunParams.TruncationStrategy truncationStrategy)
Controls for how a thread will be truncated prior to the run. Use this to control the intial context window of the run.
-
truncationStrategy
final ThreadCreateAndRunParams.Body.Builder truncationStrategy(Optional<ThreadCreateAndRunParams.TruncationStrategy> truncationStrategy)
Alias for calling Builder.truncationStrategy with
truncationStrategy.orElse(null)
.
-
truncationStrategy
final ThreadCreateAndRunParams.Body.Builder truncationStrategy(JsonField<ThreadCreateAndRunParams.TruncationStrategy> truncationStrategy)
Sets Builder.truncationStrategy to an arbitrary JSON value.
You should usually call Builder.truncationStrategy with a well-typed TruncationStrategy value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final ThreadCreateAndRunParams.Body.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final ThreadCreateAndRunParams.Body.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final ThreadCreateAndRunParams.Body.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final ThreadCreateAndRunParams.Body.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final ThreadCreateAndRunParams.Body.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final ThreadCreateAndRunParams.Body build()
Returns an immutable instance of Body.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.assistantId()
-
-
-
-