Class InputTokenCountParams.Body.Builder
-
- All Implemented Interfaces:
public final class InputTokenCountParams.Body.BuilderA builder for Body.
-
-
Method Summary
-
-
Method Detail
-
conversation
final InputTokenCountParams.Body.Builder conversation(InputTokenCountParams.Conversation conversation)
The conversation that this response belongs to. Items from this conversation are prepended to
input_itemsfor this response request. Input items and output items from this response are automatically added to this conversation after this response completes.
-
conversation
final InputTokenCountParams.Body.Builder conversation(Optional<InputTokenCountParams.Conversation> conversation)
Alias for calling Builder.conversation with
conversation.orElse(null).
-
conversation
final InputTokenCountParams.Body.Builder conversation(JsonField<InputTokenCountParams.Conversation> conversation)
Sets Builder.conversation to an arbitrary JSON value.
You should usually call Builder.conversation with a well-typed Conversation value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
conversation
final InputTokenCountParams.Body.Builder conversation(String id)
Alias for calling conversation with
Conversation.ofId(id).
-
conversation
final InputTokenCountParams.Body.Builder conversation(ResponseConversationParam responseConversationParam)
Alias for calling conversation with
Conversation.ofResponseConversationParam(responseConversationParam).
-
input
final InputTokenCountParams.Body.Builder input(InputTokenCountParams.Input input)
Text, image, or file inputs to the model, used to generate a response
-
input
final InputTokenCountParams.Body.Builder input(Optional<InputTokenCountParams.Input> input)
Alias for calling Builder.input with
input.orElse(null).
-
input
final InputTokenCountParams.Body.Builder input(JsonField<InputTokenCountParams.Input> input)
Sets Builder.input to an arbitrary JSON value.
You should usually call Builder.input with a well-typed Input value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
input
final InputTokenCountParams.Body.Builder input(String string)
Alias for calling input with
Input.ofString(string).
-
inputOfResponseInputItems
final InputTokenCountParams.Body.Builder inputOfResponseInputItems(List<ResponseInputItem> responseInputItems)
Alias for calling input with
Input.ofResponseInputItems(responseInputItems).
-
instructions
final InputTokenCountParams.Body.Builder instructions(String instructions)
A system (or developer) message inserted into the model's context. When used along with
previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
-
instructions
final InputTokenCountParams.Body.Builder instructions(Optional<String> instructions)
Alias for calling Builder.instructions with
instructions.orElse(null).
-
instructions
final InputTokenCountParams.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.
-
model
final InputTokenCountParams.Body.Builder model(String model)
Model ID used to generate the response, like
gpt-4ooro3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.
-
model
final InputTokenCountParams.Body.Builder model(Optional<String> model)
Alias for calling Builder.model with
model.orElse(null).
-
model
final InputTokenCountParams.Body.Builder model(JsonField<String> model)
Sets Builder.model to an arbitrary JSON value.
You should usually call Builder.model with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
parallelToolCalls
final InputTokenCountParams.Body.Builder parallelToolCalls(Boolean parallelToolCalls)
Whether to allow the model to run tool calls in parallel.
-
parallelToolCalls
final InputTokenCountParams.Body.Builder parallelToolCalls(Boolean parallelToolCalls)
Alias for Builder.parallelToolCalls.
This unboxed primitive overload exists for backwards compatibility.
-
parallelToolCalls
final InputTokenCountParams.Body.Builder parallelToolCalls(Optional<Boolean> parallelToolCalls)
Alias for calling Builder.parallelToolCalls with
parallelToolCalls.orElse(null).
-
parallelToolCalls
final InputTokenCountParams.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.
-
previousResponseId
final InputTokenCountParams.Body.Builder previousResponseId(String previousResponseId)
The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with
conversation.
-
previousResponseId
final InputTokenCountParams.Body.Builder previousResponseId(Optional<String> previousResponseId)
Alias for calling Builder.previousResponseId with
previousResponseId.orElse(null).
-
previousResponseId
final InputTokenCountParams.Body.Builder previousResponseId(JsonField<String> previousResponseId)
Sets Builder.previousResponseId to an arbitrary JSON value.
You should usually call Builder.previousResponseId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
reasoning
final InputTokenCountParams.Body.Builder reasoning(Reasoning reasoning)
gpt-5 and o-series models only Configuration options for reasoning models.
-
reasoning
final InputTokenCountParams.Body.Builder reasoning(Optional<Reasoning> reasoning)
Alias for calling Builder.reasoning with
reasoning.orElse(null).
-
reasoning
final InputTokenCountParams.Body.Builder reasoning(JsonField<Reasoning> reasoning)
Sets Builder.reasoning to an arbitrary JSON value.
You should usually call Builder.reasoning with a well-typed Reasoning value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
text
final InputTokenCountParams.Body.Builder text(InputTokenCountParams.Text text)
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
-
text
final InputTokenCountParams.Body.Builder text(Optional<InputTokenCountParams.Text> text)
Alias for calling Builder.text with
text.orElse(null).
-
text
final InputTokenCountParams.Body.Builder text(JsonField<InputTokenCountParams.Text> text)
Sets Builder.text to an arbitrary JSON value.
You should usually call Builder.text with a well-typed Text value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(InputTokenCountParams.ToolChoice toolChoice)
How the model should select which tool (or tools) to use when generating a response. See the
toolsparameter to see how to specify which tools the model can call.
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(Optional<InputTokenCountParams.ToolChoice> toolChoice)
Alias for calling Builder.toolChoice with
toolChoice.orElse(null).
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(JsonField<InputTokenCountParams.ToolChoice> toolChoice)
Sets Builder.toolChoice to an arbitrary JSON value.
You should usually call Builder.toolChoice with a well-typed ToolChoice value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(ToolChoiceOptions options)
Alias for calling toolChoice with
ToolChoice.ofOptions(options).
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(ToolChoiceAllowed allowed)
Alias for calling toolChoice with
ToolChoice.ofAllowed(allowed).
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(ToolChoiceTypes types)
Alias for calling toolChoice with
ToolChoice.ofTypes(types).
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(ToolChoiceFunction function)
Alias for calling toolChoice with
ToolChoice.ofFunction(function).
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(ToolChoiceMcp mcp)
Alias for calling toolChoice with
ToolChoice.ofMcp(mcp).
-
toolChoice
final InputTokenCountParams.Body.Builder toolChoice(ToolChoiceCustom custom)
Alias for calling toolChoice with
ToolChoice.ofCustom(custom).
-
tools
final InputTokenCountParams.Body.Builder tools(List<Tool> tools)
An array of tools the model may call while generating a response. You can specify which tool to use by setting the
tool_choiceparameter.
-
tools
final InputTokenCountParams.Body.Builder tools(Optional<List<Tool>> tools)
Alias for calling Builder.tools with
tools.orElse(null).
-
tools
final InputTokenCountParams.Body.Builder tools(JsonField<List<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 InputTokenCountParams.Body.Builder addTool(Tool tool)
-
addTool
final InputTokenCountParams.Body.Builder addTool(FunctionTool function)
Alias for calling addTool with
Tool.ofFunction(function).
-
addTool
final InputTokenCountParams.Body.Builder addTool(FileSearchTool fileSearch)
Alias for calling addTool with
Tool.ofFileSearch(fileSearch).
-
addTool
final InputTokenCountParams.Body.Builder addTool(ComputerTool computerUsePreview)
Alias for calling addTool with
Tool.ofComputerUsePreview(computerUsePreview).
-
addTool
final InputTokenCountParams.Body.Builder addTool(WebSearchTool webSearch)
Alias for calling addTool with
Tool.ofWebSearch(webSearch).
-
addTool
final InputTokenCountParams.Body.Builder addTool(Tool.Mcp mcp)
Alias for calling addTool with
Tool.ofMcp(mcp).
-
addTool
final InputTokenCountParams.Body.Builder addTool(Tool.CodeInterpreter codeInterpreter)
Alias for calling addTool with
Tool.ofCodeInterpreter(codeInterpreter).
-
addTool
final InputTokenCountParams.Body.Builder addTool(Tool.ImageGeneration imageGeneration)
Alias for calling addTool with
Tool.ofImageGeneration(imageGeneration).
-
addTool
final InputTokenCountParams.Body.Builder addTool(CustomTool custom)
Alias for calling addTool with
Tool.ofCustom(custom).
-
addTool
final InputTokenCountParams.Body.Builder addTool(WebSearchPreviewTool webSearchPreview)
Alias for calling addTool with
Tool.ofWebSearchPreview(webSearchPreview).
-
addFileSearchTool
final InputTokenCountParams.Body.Builder addFileSearchTool(List<String> vectorStoreIds)
Alias for calling addTool with the following:
FileSearchTool.builder() .vectorStoreIds(vectorStoreIds) .build()
-
addMcpTool
final InputTokenCountParams.Body.Builder addMcpTool(String serverLabel)
Alias for calling addTool with the following:
Tool.Mcp.builder() .serverLabel(serverLabel) .build()
-
addCodeInterpreterTool
final InputTokenCountParams.Body.Builder addCodeInterpreterTool(Tool.CodeInterpreter.Container container)
Alias for calling addTool with the following:
Tool.CodeInterpreter.builder() .container(container) .build()
-
addCodeInterpreterTool
final InputTokenCountParams.Body.Builder addCodeInterpreterTool(String string)
Alias for calling addCodeInterpreterTool with
Tool.CodeInterpreter.Container.ofString(string).
-
addCodeInterpreterTool
final InputTokenCountParams.Body.Builder addCodeInterpreterTool(Tool.CodeInterpreter.Container.CodeInterpreterToolAuto codeInterpreterToolAuto)
Alias for calling addCodeInterpreterTool with
Tool.CodeInterpreter.Container.ofCodeInterpreterToolAuto(codeInterpreterToolAuto).
-
addToolLocalShell
final InputTokenCountParams.Body.Builder addToolLocalShell()
Alias for calling addTool with
Tool.ofLocalShell().
-
addCustomTool
final InputTokenCountParams.Body.Builder addCustomTool(String name)
Alias for calling addTool with the following:
CustomTool.builder() .name(name) .build()
-
truncation
final InputTokenCountParams.Body.Builder truncation(InputTokenCountParams.Truncation truncation)
The truncation strategy to use for the model response. -
auto: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. -disabled(default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.
-
truncation
final InputTokenCountParams.Body.Builder truncation(JsonField<InputTokenCountParams.Truncation> truncation)
Sets Builder.truncation to an arbitrary JSON value.
You should usually call Builder.truncation with a well-typed Truncation value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final InputTokenCountParams.Body.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final InputTokenCountParams.Body.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final InputTokenCountParams.Body.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final InputTokenCountParams.Body.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final InputTokenCountParams.Body.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final InputTokenCountParams.Body build()
Returns an immutable instance of Body.
Further updates to this Builder will not mutate the returned instance.
-
-
-
-