Class AssistantCreateParams.Builder
-
- All Implemented Interfaces:
public final class AssistantCreateParams.Builder
A builder for AssistantCreateParams.
-
-
Method Summary
-
-
Method Detail
-
body
final AssistantCreateParams.Builder body(AssistantCreateParams.Body body)
Sets the entire request body.
This is generally only useful if you are already constructing the body separately. Otherwise, it's more convenient to use the top-level setters instead:
-
model
final AssistantCreateParams.Builder model(ChatModel model)
ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
-
model
final AssistantCreateParams.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 AssistantCreateParams.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.
-
description
final AssistantCreateParams.Builder description(String description)
The description of the assistant. The maximum length is 512 characters.
-
description
final AssistantCreateParams.Builder description(Optional<String> description)
Alias for calling Builder.description with
description.orElse(null)
.
-
description
final AssistantCreateParams.Builder description(JsonField<String> description)
Sets Builder.description to an arbitrary JSON value.
You should usually call Builder.description 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 AssistantCreateParams.Builder instructions(String instructions)
The system instructions that the assistant uses. The maximum length is 256,000 characters.
-
instructions
final AssistantCreateParams.Builder instructions(Optional<String> instructions)
Alias for calling Builder.instructions with
instructions.orElse(null)
.
-
instructions
final AssistantCreateParams.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.
-
metadata
final AssistantCreateParams.Builder metadata(AssistantCreateParams.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 AssistantCreateParams.Builder metadata(Optional<AssistantCreateParams.Metadata> metadata)
Alias for calling Builder.metadata with
metadata.orElse(null)
.
-
metadata
final AssistantCreateParams.Builder metadata(JsonField<AssistantCreateParams.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.
-
name
final AssistantCreateParams.Builder name(String name)
The name of the assistant. The maximum length is 256 characters.
-
name
final AssistantCreateParams.Builder name(Optional<String> name)
Alias for calling Builder.name with
name.orElse(null)
.
-
name
final AssistantCreateParams.Builder name(JsonField<String> name)
Sets Builder.name to an arbitrary JSON value.
You should usually call Builder.name with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
reasoningEffort
final AssistantCreateParams.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 AssistantCreateParams.Builder reasoningEffort(Optional<ReasoningEffort> reasoningEffort)
Alias for calling Builder.reasoningEffort with
reasoningEffort.orElse(null)
.
-
reasoningEffort
final AssistantCreateParams.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 AssistantCreateParams.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 AssistantCreateParams.Builder responseFormat(Optional<AssistantResponseFormatOption> responseFormat)
Alias for calling Builder.responseFormat with
responseFormat.orElse(null)
.
-
responseFormat
final AssistantCreateParams.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 AssistantCreateParams.Builder responseFormat(ResponseFormatText responseFormatText)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatText(responseFormatText)
.
-
responseFormat
final AssistantCreateParams.Builder responseFormat(ResponseFormatJsonObject responseFormatJsonObject)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatJsonObject(responseFormatJsonObject)
.
-
responseFormat
final AssistantCreateParams.Builder responseFormat(ResponseFormatJsonSchema responseFormatJsonSchema)
Alias for calling responseFormat with
AssistantResponseFormatOption.ofResponseFormatJsonSchema(responseFormatJsonSchema)
.
-
responseFormatAuto
final AssistantCreateParams.Builder responseFormatAuto()
Alias for calling responseFormat with
AssistantResponseFormatOption.ofAuto()
.
-
temperature
final AssistantCreateParams.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 AssistantCreateParams.Builder temperature(Double temperature)
Alias for Builder.temperature.
This unboxed primitive overload exists for backwards compatibility.
-
temperature
final AssistantCreateParams.Builder temperature(Optional<Double> temperature)
Alias for calling Builder.temperature with
temperature.orElse(null)
.
-
temperature
final AssistantCreateParams.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.
-
toolResources
final AssistantCreateParams.Builder toolResources(AssistantCreateParams.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 AssistantCreateParams.Builder toolResources(Optional<AssistantCreateParams.ToolResources> toolResources)
Alias for calling Builder.toolResources with
toolResources.orElse(null)
.
-
toolResources
final AssistantCreateParams.Builder toolResources(JsonField<AssistantCreateParams.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 AssistantCreateParams.Builder tools(List<AssistantTool> tools)
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
, orfunction
.
-
tools
final AssistantCreateParams.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 AssistantCreateParams.Builder addTool(AssistantTool tool)
Adds a single AssistantTool to tools.
-
addTool
final AssistantCreateParams.Builder addTool(CodeInterpreterTool codeInterpreter)
Alias for calling addTool with
AssistantTool.ofCodeInterpreter(codeInterpreter)
.
-
addTool
final AssistantCreateParams.Builder addTool(FileSearchTool fileSearch)
Alias for calling addTool with
AssistantTool.ofFileSearch(fileSearch)
.
-
addTool
final AssistantCreateParams.Builder addTool(FunctionTool function)
Alias for calling addTool with
AssistantTool.ofFunction(function)
.
-
addFunctionTool
final AssistantCreateParams.Builder addFunctionTool(FunctionDefinition function)
Alias for calling addTool with the following:
FunctionTool.builder() .function(function) .build()
-
topP
final AssistantCreateParams.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 AssistantCreateParams.Builder topP(Double topP)
Alias for Builder.topP.
This unboxed primitive overload exists for backwards compatibility.
-
topP
final AssistantCreateParams.Builder topP(Optional<Double> topP)
Alias for calling Builder.topP with
topP.orElse(null)
.
-
topP
final AssistantCreateParams.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.
-
additionalBodyProperties
final AssistantCreateParams.Builder additionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
putAdditionalBodyProperty
final AssistantCreateParams.Builder putAdditionalBodyProperty(String key, JsonValue value)
-
putAllAdditionalBodyProperties
final AssistantCreateParams.Builder putAllAdditionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
removeAdditionalBodyProperty
final AssistantCreateParams.Builder removeAdditionalBodyProperty(String key)
-
removeAllAdditionalBodyProperties
final AssistantCreateParams.Builder removeAllAdditionalBodyProperties(Set<String> keys)
-
additionalHeaders
final AssistantCreateParams.Builder additionalHeaders(Headers additionalHeaders)
-
additionalHeaders
final AssistantCreateParams.Builder additionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
putAdditionalHeader
final AssistantCreateParams.Builder putAdditionalHeader(String name, String value)
-
putAdditionalHeaders
final AssistantCreateParams.Builder putAdditionalHeaders(String name, Iterable<String> values)
-
putAllAdditionalHeaders
final AssistantCreateParams.Builder putAllAdditionalHeaders(Headers additionalHeaders)
-
putAllAdditionalHeaders
final AssistantCreateParams.Builder putAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
replaceAdditionalHeaders
final AssistantCreateParams.Builder replaceAdditionalHeaders(String name, String value)
-
replaceAdditionalHeaders
final AssistantCreateParams.Builder replaceAdditionalHeaders(String name, Iterable<String> values)
-
replaceAllAdditionalHeaders
final AssistantCreateParams.Builder replaceAllAdditionalHeaders(Headers additionalHeaders)
-
replaceAllAdditionalHeaders
final AssistantCreateParams.Builder replaceAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
removeAdditionalHeaders
final AssistantCreateParams.Builder removeAdditionalHeaders(String name)
-
removeAllAdditionalHeaders
final AssistantCreateParams.Builder removeAllAdditionalHeaders(Set<String> names)
-
additionalQueryParams
final AssistantCreateParams.Builder additionalQueryParams(QueryParams additionalQueryParams)
-
additionalQueryParams
final AssistantCreateParams.Builder additionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
putAdditionalQueryParam
final AssistantCreateParams.Builder putAdditionalQueryParam(String key, String value)
-
putAdditionalQueryParams
final AssistantCreateParams.Builder putAdditionalQueryParams(String key, Iterable<String> values)
-
putAllAdditionalQueryParams
final AssistantCreateParams.Builder putAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
putAllAdditionalQueryParams
final AssistantCreateParams.Builder putAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
replaceAdditionalQueryParams
final AssistantCreateParams.Builder replaceAdditionalQueryParams(String key, String value)
-
replaceAdditionalQueryParams
final AssistantCreateParams.Builder replaceAdditionalQueryParams(String key, Iterable<String> values)
-
replaceAllAdditionalQueryParams
final AssistantCreateParams.Builder replaceAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
replaceAllAdditionalQueryParams
final AssistantCreateParams.Builder replaceAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
removeAdditionalQueryParams
final AssistantCreateParams.Builder removeAdditionalQueryParams(String key)
-
removeAllAdditionalQueryParams
final AssistantCreateParams.Builder removeAllAdditionalQueryParams(Set<String> keys)
-
build
final AssistantCreateParams build()
Returns an immutable instance of AssistantCreateParams.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.model()
-
-
-
-