Class StructuredMessage.Builder
-
- All Implemented Interfaces:
public final class StructuredMessage.Builder<T extends Object>A builder for StructuredMessage.
-
-
Method Summary
Modifier and Type Method Description final StructuredMessage.Builder<T>id(String id)final StructuredMessage.Builder<T>id(JsonField<String> id)Sets Builder.id to an arbitrary JSON value. final StructuredMessage.Builder<T>container(Container container)final StructuredMessage.Builder<T>container(Optional<Container> container)Alias for calling Builder.container with container.orElse(null).final StructuredMessage.Builder<T>container(JsonField<Container> container)Sets Builder.container to an arbitrary JSON value. final StructuredMessage.Builder<T>content(List<ContentBlock> content)final StructuredMessage.Builder<T>content(JsonField<List<ContentBlock>> content)Sets Builder.content to an arbitrary JSON value. final StructuredMessage.Builder<T>addContent(ContentBlock content)Adds a single ContentBlock to Builder.content. final StructuredMessage.Builder<T>addContent(TextBlock text)Alias for calling addContent with ContentBlock.ofText(text).final StructuredMessage.Builder<T>addContent(ThinkingBlock thinking)Alias for calling addContent with ContentBlock.ofThinking(thinking).final StructuredMessage.Builder<T>addContent(RedactedThinkingBlock redactedThinking)Alias for calling addContent with ContentBlock.ofRedactedThinking(redactedThinking).final StructuredMessage.Builder<T>addContent(ToolUseBlock toolUse)Alias for calling addContent with ContentBlock.ofToolUse(toolUse).final StructuredMessage.Builder<T>addContent(ServerToolUseBlock serverToolUse)Alias for calling addContent with ContentBlock.ofServerToolUse(serverToolUse).final StructuredMessage.Builder<T>addContent(WebSearchToolResultBlock webSearchToolResult)Alias for calling addContent with ContentBlock.ofWebSearchToolResult(webSearchToolResult).final StructuredMessage.Builder<T>addContent(WebFetchToolResultBlock webFetchToolResult)Alias for calling addContent with ContentBlock.ofWebFetchToolResult(webFetchToolResult).final StructuredMessage.Builder<T>addContent(CodeExecutionToolResultBlock codeExecutionToolResult)Alias for calling addContent with ContentBlock.ofCodeExecutionToolResult(codeExecutionToolResult).final StructuredMessage.Builder<T>addContent(BashCodeExecutionToolResultBlock bashCodeExecutionToolResult)Alias for calling addContent with ContentBlock.ofBashCodeExecutionToolResult(bashCodeExecutionToolResult).final StructuredMessage.Builder<T>addContent(TextEditorCodeExecutionToolResultBlock textEditorCodeExecutionToolResult)Alias for calling addContent with ContentBlock.ofTextEditorCodeExecutionToolResult(textEditorCodeExecutionToolResult).final StructuredMessage.Builder<T>addContent(ToolSearchToolResultBlock toolSearchToolResult)Alias for calling addContent with ContentBlock.ofToolSearchToolResult(toolSearchToolResult).final StructuredMessage.Builder<T>addContent(ContainerUploadBlock containerUpload)Alias for calling addContent with ContentBlock.ofContainerUpload(containerUpload).final StructuredMessage.Builder<T>addRedactedThinkingContent(String data)Alias for calling addContent with the following: RedactedThinkingBlock.builder() .data(data) .build()final StructuredMessage.Builder<T>addContainerUploadContent(String fileId)Alias for calling addContent with the following: ContainerUploadBlock.builder() .fileId(fileId) .build()final StructuredMessage.Builder<T>diagnostics(Diagnostics diagnostics)final StructuredMessage.Builder<T>diagnostics(Optional<Diagnostics> diagnostics)Alias for calling Builder.diagnostics with diagnostics.orElse(null).final StructuredMessage.Builder<T>diagnostics(JsonField<Diagnostics> diagnostics)Sets Builder.diagnostics to an arbitrary JSON value. final StructuredMessage.Builder<T>model(Model model)final StructuredMessage.Builder<T>model(JsonField<Model> model)Sets Builder.model to an arbitrary JSON value. final StructuredMessage.Builder<T>model(String value)Sets model to an arbitrary String. final StructuredMessage.Builder<T>role(JsonValue role)Sets the field to an arbitrary JSON value. final StructuredMessage.Builder<T>stopDetails(RefusalStopDetails stopDetails)final StructuredMessage.Builder<T>stopDetails(Optional<RefusalStopDetails> stopDetails)Alias for calling Builder.stopDetails with stopDetails.orElse(null).final StructuredMessage.Builder<T>stopDetails(JsonField<RefusalStopDetails> stopDetails)Sets Builder.stopDetails to an arbitrary JSON value. final StructuredMessage.Builder<T>stopReason(StopReason stopReason)final StructuredMessage.Builder<T>stopReason(Optional<StopReason> stopReason)Alias for calling Builder.stopReason with stopReason.orElse(null).final StructuredMessage.Builder<T>stopReason(JsonField<StopReason> stopReason)Sets Builder.stopReason to an arbitrary JSON value. final StructuredMessage.Builder<T>stopSequence(String stopSequence)final StructuredMessage.Builder<T>stopSequence(Optional<String> stopSequence)Alias for calling Builder.stopSequence with stopSequence.orElse(null).final StructuredMessage.Builder<T>stopSequence(JsonField<String> stopSequence)Sets Builder.stopSequence to an arbitrary JSON value. final StructuredMessage.Builder<T>type(JsonValue type)Sets the field to an arbitrary JSON value. final StructuredMessage.Builder<T>usage(Usage usage)final StructuredMessage.Builder<T>usage(JsonField<Usage> usage)Sets Builder.usage to an arbitrary JSON value. final StructuredMessage.Builder<T>additionalProperties(Map<String, JsonValue> additionalProperties)final StructuredMessage.Builder<T>putAdditionalProperty(String key, JsonValue value)final StructuredMessage.Builder<T>putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)final StructuredMessage.Builder<T>removeAdditionalProperty(String key)final StructuredMessage.Builder<T>removeAllAdditionalProperties(Set<String> keys)final StructuredMessage<T>build()Returns an immutable instance of StructuredMessage. -
-
Method Detail
-
id
final StructuredMessage.Builder<T> id(String id)
-
id
final StructuredMessage.Builder<T> id(JsonField<String> id)
Sets Builder.id to an arbitrary JSON value.
You should usually call Builder.id with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
container
final StructuredMessage.Builder<T> container(Container container)
-
container
final StructuredMessage.Builder<T> container(Optional<Container> container)
Alias for calling Builder.container with
container.orElse(null).
-
container
final StructuredMessage.Builder<T> container(JsonField<Container> container)
Sets Builder.container to an arbitrary JSON value.
You should usually call Builder.container with a well-typed Container value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
content
final StructuredMessage.Builder<T> content(List<ContentBlock> content)
-
content
final StructuredMessage.Builder<T> content(JsonField<List<ContentBlock>> content)
Sets Builder.content to an arbitrary JSON value.
You should usually call Builder.content with a well-typed
List<ContentBlock>value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addContent
final StructuredMessage.Builder<T> addContent(ContentBlock content)
Adds a single ContentBlock to Builder.content.
-
addContent
final StructuredMessage.Builder<T> addContent(TextBlock text)
Alias for calling addContent with
ContentBlock.ofText(text).
-
addContent
final StructuredMessage.Builder<T> addContent(ThinkingBlock thinking)
Alias for calling addContent with
ContentBlock.ofThinking(thinking).
-
addContent
final StructuredMessage.Builder<T> addContent(RedactedThinkingBlock redactedThinking)
Alias for calling addContent with
ContentBlock.ofRedactedThinking(redactedThinking).
-
addContent
final StructuredMessage.Builder<T> addContent(ToolUseBlock toolUse)
Alias for calling addContent with
ContentBlock.ofToolUse(toolUse).
-
addContent
final StructuredMessage.Builder<T> addContent(ServerToolUseBlock serverToolUse)
Alias for calling addContent with
ContentBlock.ofServerToolUse(serverToolUse).
-
addContent
final StructuredMessage.Builder<T> addContent(WebSearchToolResultBlock webSearchToolResult)
Alias for calling addContent with
ContentBlock.ofWebSearchToolResult(webSearchToolResult).
-
addContent
final StructuredMessage.Builder<T> addContent(WebFetchToolResultBlock webFetchToolResult)
Alias for calling addContent with
ContentBlock.ofWebFetchToolResult(webFetchToolResult).
-
addContent
final StructuredMessage.Builder<T> addContent(CodeExecutionToolResultBlock codeExecutionToolResult)
Alias for calling addContent with
ContentBlock.ofCodeExecutionToolResult(codeExecutionToolResult).
-
addContent
final StructuredMessage.Builder<T> addContent(BashCodeExecutionToolResultBlock bashCodeExecutionToolResult)
Alias for calling addContent with
ContentBlock.ofBashCodeExecutionToolResult(bashCodeExecutionToolResult).
-
addContent
final StructuredMessage.Builder<T> addContent(TextEditorCodeExecutionToolResultBlock textEditorCodeExecutionToolResult)
Alias for calling addContent with
ContentBlock.ofTextEditorCodeExecutionToolResult(textEditorCodeExecutionToolResult).
-
addContent
final StructuredMessage.Builder<T> addContent(ToolSearchToolResultBlock toolSearchToolResult)
Alias for calling addContent with
ContentBlock.ofToolSearchToolResult(toolSearchToolResult).
-
addContent
final StructuredMessage.Builder<T> addContent(ContainerUploadBlock containerUpload)
Alias for calling addContent with
ContentBlock.ofContainerUpload(containerUpload).
-
addRedactedThinkingContent
final StructuredMessage.Builder<T> addRedactedThinkingContent(String data)
Alias for calling addContent with the following:
RedactedThinkingBlock.builder() .data(data) .build()
-
addContainerUploadContent
final StructuredMessage.Builder<T> addContainerUploadContent(String fileId)
Alias for calling addContent with the following:
ContainerUploadBlock.builder() .fileId(fileId) .build()
-
diagnostics
final StructuredMessage.Builder<T> diagnostics(Diagnostics diagnostics)
-
diagnostics
final StructuredMessage.Builder<T> diagnostics(Optional<Diagnostics> diagnostics)
Alias for calling Builder.diagnostics with
diagnostics.orElse(null).
-
diagnostics
final StructuredMessage.Builder<T> diagnostics(JsonField<Diagnostics> diagnostics)
Sets Builder.diagnostics to an arbitrary JSON value.
You should usually call Builder.diagnostics with a well-typed Diagnostics value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final StructuredMessage.Builder<T> model(Model model)
-
model
final StructuredMessage.Builder<T> model(JsonField<Model> model)
Sets Builder.model to an arbitrary JSON value.
You should usually call Builder.model with a well-typed Model value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final StructuredMessage.Builder<T> model(String value)
Sets model to an arbitrary String.
You should usually call model with a well-typed Model constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
role
final StructuredMessage.Builder<T> role(JsonValue role)
Sets the field to an arbitrary JSON value.
It is usually unnecessary to call this method because the field defaults to the following:
JsonValue.from("assistant")This method is primarily for setting the field to an undocumented or not yet supported value.
-
stopDetails
final StructuredMessage.Builder<T> stopDetails(RefusalStopDetails stopDetails)
-
stopDetails
final StructuredMessage.Builder<T> stopDetails(Optional<RefusalStopDetails> stopDetails)
Alias for calling Builder.stopDetails with
stopDetails.orElse(null).
-
stopDetails
final StructuredMessage.Builder<T> stopDetails(JsonField<RefusalStopDetails> stopDetails)
Sets Builder.stopDetails to an arbitrary JSON value.
You should usually call Builder.stopDetails with a well-typed RefusalStopDetails value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
stopReason
final StructuredMessage.Builder<T> stopReason(StopReason stopReason)
-
stopReason
final StructuredMessage.Builder<T> stopReason(Optional<StopReason> stopReason)
Alias for calling Builder.stopReason with
stopReason.orElse(null).
-
stopReason
final StructuredMessage.Builder<T> stopReason(JsonField<StopReason> stopReason)
Sets Builder.stopReason to an arbitrary JSON value.
You should usually call Builder.stopReason with a well-typed StopReason value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
stopSequence
final StructuredMessage.Builder<T> stopSequence(String stopSequence)
-
stopSequence
final StructuredMessage.Builder<T> stopSequence(Optional<String> stopSequence)
Alias for calling Builder.stopSequence with
stopSequence.orElse(null).
-
stopSequence
final StructuredMessage.Builder<T> stopSequence(JsonField<String> stopSequence)
Sets Builder.stopSequence to an arbitrary JSON value.
You should usually call Builder.stopSequence with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
type
final StructuredMessage.Builder<T> type(JsonValue type)
Sets the field to an arbitrary JSON value.
It is usually unnecessary to call this method because the field defaults to the following:
JsonValue.from("message")This method is primarily for setting the field to an undocumented or not yet supported value.
-
usage
final StructuredMessage.Builder<T> usage(Usage usage)
-
usage
final StructuredMessage.Builder<T> usage(JsonField<Usage> usage)
Sets Builder.usage to an arbitrary JSON value.
You should usually call Builder.usage with a well-typed Usage value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final StructuredMessage.Builder<T> additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final StructuredMessage.Builder<T> putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final StructuredMessage.Builder<T> putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final StructuredMessage.Builder<T> removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final StructuredMessage.Builder<T> removeAllAdditionalProperties(Set<String> keys)
-
build
final StructuredMessage<T> build()
Returns an immutable instance of StructuredMessage.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.id() .container() .content() .diagnostics() .model() .stopDetails() .stopReason() .stopSequence() .usage()
-
-
-
-