Class RunCreateParams.Body.Builder
-
- All Implemented Interfaces:
public final class RunCreateParams.Body.Builder
A builder for Body.
-
-
Method Summary
-
-
Method Detail
-
assistantId
final RunCreateParams.Body.Builder assistantId(String assistantId)
The ID of the assistant to use to execute this run.
-
assistantId
final RunCreateParams.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.
-
additionalInstructions
final RunCreateParams.Body.Builder additionalInstructions(String additionalInstructions)
Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.
-
additionalInstructions
final RunCreateParams.Body.Builder additionalInstructions(Optional<String> additionalInstructions)
Alias for calling Builder.additionalInstructions with
additionalInstructions.orElse(null)
.
-
additionalInstructions
final RunCreateParams.Body.Builder additionalInstructions(JsonField<String> additionalInstructions)
Sets Builder.additionalInstructions to an arbitrary JSON value.
You should usually call Builder.additionalInstructions with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalMessages
final RunCreateParams.Body.Builder additionalMessages(List<RunCreateParams.AdditionalMessage> additionalMessages)
Adds additional messages to the thread before creating the run.
-
additionalMessages
final RunCreateParams.Body.Builder additionalMessages(Optional<List<RunCreateParams.AdditionalMessage>> additionalMessages)
Alias for calling Builder.additionalMessages with
additionalMessages.orElse(null)
.
-
additionalMessages
final RunCreateParams.Body.Builder additionalMessages(JsonField<List<RunCreateParams.AdditionalMessage>> additionalMessages)
Sets Builder.additionalMessages to an arbitrary JSON value.
You should usually call Builder.additionalMessages with a well-typed
List<AdditionalMessage>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addAdditionalMessage
final RunCreateParams.Body.Builder addAdditionalMessage(RunCreateParams.AdditionalMessage additionalMessage)
Adds a single AdditionalMessage to additionalMessages.
-
instructions
final RunCreateParams.Body.Builder instructions(String instructions)
Overrides the instructions of the assistant. This is useful for modifying the behavior on a per-run basis.
-
instructions
final RunCreateParams.Body.Builder instructions(Optional<String> instructions)
Alias for calling Builder.instructions with
instructions.orElse(null)
.
-
instructions
final RunCreateParams.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 RunCreateParams.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 RunCreateParams.Body.Builder maxCompletionTokens(Long maxCompletionTokens)
Alias for Builder.maxCompletionTokens.
This unboxed primitive overload exists for backwards compatibility.
-
maxCompletionTokens
final RunCreateParams.Body.Builder maxCompletionTokens(Optional<Long> maxCompletionTokens)
Alias for calling Builder.maxCompletionTokens with
maxCompletionTokens.orElse(null)
.
-
maxCompletionTokens
final RunCreateParams.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 RunCreateParams.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 RunCreateParams.Body.Builder maxPromptTokens(Long maxPromptTokens)
Alias for Builder.maxPromptTokens.
This unboxed primitive overload exists for backwards compatibility.
-
maxPromptTokens
final RunCreateParams.Body.Builder maxPromptTokens(Optional<Long> maxPromptTokens)
Alias for calling Builder.maxPromptTokens with
maxPromptTokens.orElse(null)
.
-
maxPromptTokens
final RunCreateParams.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 RunCreateParams.Body.Builder metadata(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 RunCreateParams.Body.Builder metadata(Optional<Metadata> metadata)
Alias for calling Builder.metadata with
metadata.orElse(null)
.
-
metadata
final RunCreateParams.Body.Builder metadata(JsonField<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 RunCreateParams.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 RunCreateParams.Body.Builder model(Optional<ChatModel> model)
Alias for calling Builder.model with
model.orElse(null)
.
-
model
final RunCreateParams.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 RunCreateParams.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 RunCreateParams.Body.Builder parallelToolCalls(Boolean parallelToolCalls)
Whether to enable parallel function calling during tool use.
-
parallelToolCalls
final RunCreateParams.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.
-
reasoningEffort
final RunCreateParams.Body.Builder reasoningEffort(ReasoningEffort reasoningEffort)
o-series models only
Constrains effort on reasoning for reasoning models. Currently supported values are
low
,medium
, andhigh
. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
-
reasoningEffort
final RunCreateParams.Body.Builder reasoningEffort(Optional<ReasoningEffort> reasoningEffort)
Alias for calling Builder.reasoningEffort with
reasoningEffort.orElse(null)
.
-
reasoningEffort
final RunCreateParams.Body.Builder reasoningEffort(JsonField<ReasoningEffort> reasoningEffort)
Sets Builder.reasoningEffort to an arbitrary JSON value.
You should usually call Builder.reasoningEffort with a well-typed ReasoningEffort value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
responseFormat
final RunCreateParams.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 RunCreateParams.Body.Builder responseFormat(Optional<AssistantResponseFormatOption> responseFormat)
Alias for calling Builder.responseFormat with
responseFormat.orElse(null)
.
-
responseFormat
final RunCreateParams.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 RunCreateParams.Body.Builder responseFormat(ResponseFormatText responseFormatText)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatText(responseFormatText)
.
-
responseFormat
final RunCreateParams.Body.Builder responseFormat(ResponseFormatJsonObject responseFormatJsonObject)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatJsonObject(responseFormatJsonObject)
.
-
responseFormat
final RunCreateParams.Body.Builder responseFormat(ResponseFormatJsonSchema responseFormatJsonSchema)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatJsonSchema(responseFormatJsonSchema)
.
-
responseFormatJsonValue
final RunCreateParams.Body.Builder responseFormatJsonValue()
Alias for calling responseFormat with
AssistantResponseFormatOption.ofJsonValue()
.
-
temperature
final RunCreateParams.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 RunCreateParams.Body.Builder temperature(Double temperature)
Alias for Builder.temperature.
This unboxed primitive overload exists for backwards compatibility.
-
temperature
final RunCreateParams.Body.Builder temperature(Optional<Double> temperature)
Alias for calling Builder.temperature with
temperature.orElse(null)
.
-
temperature
final RunCreateParams.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.
-
toolChoice
final RunCreateParams.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 RunCreateParams.Body.Builder toolChoice(Optional<AssistantToolChoiceOption> toolChoice)
Alias for calling Builder.toolChoice with
toolChoice.orElse(null)
.
-
toolChoice
final RunCreateParams.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 RunCreateParams.Body.Builder toolChoice(AssistantToolChoiceOption.Auto auto)
Alias for calling toolChoice with
AssistantToolChoiceOption.ofAuto(auto)
.
-
toolChoice
final RunCreateParams.Body.Builder toolChoice(AssistantToolChoice assistantToolChoice)
Alias for calling toolChoice with
AssistantToolChoiceOption.ofAssistantToolChoice(assistantToolChoice)
.
-
tools
final RunCreateParams.Body.Builder tools(List<AssistantTool> 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 RunCreateParams.Body.Builder tools(Optional<List<AssistantTool>> tools)
Alias for calling Builder.tools with
tools.orElse(null)
.
-
tools
final RunCreateParams.Body.Builder tools(JsonField<List<AssistantTool>> tools)
Sets Builder.tools to an arbitrary JSON value.
You should usually call Builder.tools with a well-typed
List<AssistantTool>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addTool
final RunCreateParams.Body.Builder addTool(AssistantTool tool)
Adds a single AssistantTool to tools.
-
addTool
final RunCreateParams.Body.Builder addTool(CodeInterpreterTool codeInterpreter)
Alias for calling addTool with
AssistantTool.ofCodeInterpreter(codeInterpreter)
.
-
addTool
final RunCreateParams.Body.Builder addTool(FileSearchTool fileSearch)
Alias for calling addTool with
AssistantTool.ofFileSearch(fileSearch)
.
-
addTool
final RunCreateParams.Body.Builder addTool(FunctionTool function)
Alias for calling addTool with
AssistantTool.ofFunction(function)
.
-
addFunctionTool
final RunCreateParams.Body.Builder addFunctionTool(FunctionDefinition function)
Alias for calling addTool with the following:
FunctionTool.builder() .function(function) .build()
-
topP
final RunCreateParams.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 RunCreateParams.Body.Builder topP(Double topP)
Alias for Builder.topP.
This unboxed primitive overload exists for backwards compatibility.
-
topP
final RunCreateParams.Body.Builder topP(Optional<Double> topP)
Alias for calling Builder.topP with
topP.orElse(null)
.
-
topP
final RunCreateParams.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 RunCreateParams.Body.Builder truncationStrategy(RunCreateParams.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 RunCreateParams.Body.Builder truncationStrategy(Optional<RunCreateParams.TruncationStrategy> truncationStrategy)
Alias for calling Builder.truncationStrategy with
truncationStrategy.orElse(null)
.
-
truncationStrategy
final RunCreateParams.Body.Builder truncationStrategy(JsonField<RunCreateParams.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 RunCreateParams.Body.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final RunCreateParams.Body.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final RunCreateParams.Body.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final RunCreateParams.Body.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final RunCreateParams.Body.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final RunCreateParams.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()
-
-
-
-