Class InputTokenCountParams.Conversation
-
- All Implemented Interfaces:
public final class InputTokenCountParams.ConversationThe 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceInputTokenCountParams.Conversation.VisitorAn interface that defines how to map each variant of Conversation to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<String>id()The unique ID of the conversation. final Optional<ResponseConversationParam>responseConversationParam()The conversation that this response belongs to. final BooleanisId()final BooleanisResponseConversationParam()final StringasId()The unique ID of the conversation. final ResponseConversationParamasResponseConversationParam()The conversation that this response belongs to. final Optional<JsonValue>_json()final <T extends Any> Taccept(InputTokenCountParams.Conversation.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final InputTokenCountParams.Conversationvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static InputTokenCountParams.ConversationofId(String id)The unique ID of the conversation. final static InputTokenCountParams.ConversationofResponseConversationParam(ResponseConversationParam responseConversationParam)The conversation that this response belongs to. -
-
Method Detail
-
responseConversationParam
final Optional<ResponseConversationParam> responseConversationParam()
The conversation that this response belongs to.
-
isResponseConversationParam
final Boolean isResponseConversationParam()
-
asResponseConversationParam
final ResponseConversationParam asResponseConversationParam()
The conversation that this response belongs to.
-
accept
final <T extends Any> T accept(InputTokenCountParams.Conversation.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = conversation.accept(new Conversation.Visitor<Optional<String>>() { @Override public Optional<String> visitId(String id) { return Optional.of(id.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final InputTokenCountParams.Conversation validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofId
final static InputTokenCountParams.Conversation ofId(String id)
The unique ID of the conversation.
-
ofResponseConversationParam
final static InputTokenCountParams.Conversation ofResponseConversationParam(ResponseConversationParam responseConversationParam)
The conversation that this response belongs to.
-
-
-
-