Class BetaMessageThreadParam
-
- All Implemented Interfaces:
public final class BetaMessageThreadParamServer-held conversation state (a Thread).
{"type": "create"}asks the server to hold this conversation's state under the response'sid;{"type": "continue", "previous_message_id": ...}resumes from a previous response so only the new turn's messages are sent. The response shape is unchanged.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaMessageThreadParam.VisitorAn interface that defines how to map each variant of BetaMessageThreadParam to a value of type T.
public final classBetaMessageThreadParam.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaThreadCreateParams>create()Start holding conversation state under this response's `id`.final Optional<BetaThreadContinueParams>continue_()Resume from the response named by `previous_message_id`.final Optional<JsonValue>_json()final BetaMessageThreadParam.Typetype()final BooleanisCreate()final BooleanisContinue()final BetaThreadCreateParamsasCreate()Start holding conversation state under this response's `id`.final BetaThreadContinueParamsasContinue()Resume from the response named by `previous_message_id`.final <T extends Any> Taccept(BetaMessageThreadParam.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaMessageThreadParamvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaMessageThreadParamofCreate(BetaThreadCreateParams create)Start holding conversation state under this response's `id`.final static BetaMessageThreadParamofContinue(BetaThreadContinueParams continue_)Resume from the response named by `previous_message_id`.final static BetaMessageThreadParamofContinue(String previousMessageId)Returns an immutable instance of BetaMessageThreadParam whose ofContinue variant is built from the given required previousMessageId. -
-
Method Detail
-
create
final Optional<BetaThreadCreateParams> create()
Start holding conversation state under this response's
`id`.
-
continue_
final Optional<BetaThreadContinueParams> continue_()
Resume from the response named by
`previous_message_id`.
-
type
final BetaMessageThreadParam.Type type()
-
isContinue
final Boolean isContinue()
-
asCreate
final BetaThreadCreateParams asCreate()
Start holding conversation state under this response's
`id`.
-
asContinue
final BetaThreadContinueParams asContinue()
Resume from the response named by
`previous_message_id`.
-
accept
final <T extends Any> T accept(BetaMessageThreadParam.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.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = betaMessageThreadParam.accept(new BetaMessageThreadParam.Visitor<Optional<String>>() { @Override public Optional<String> visitCreate(BetaThreadCreateParams create) { return Optional.of(create.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaMessageThreadParam 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.
-
ofCreate
final static BetaMessageThreadParam ofCreate(BetaThreadCreateParams create)
Start holding conversation state under this response's
`id`.
-
ofContinue
final static BetaMessageThreadParam ofContinue(BetaThreadContinueParams continue_)
Resume from the response named by
`previous_message_id`.
-
ofContinue
final static BetaMessageThreadParam ofContinue(String previousMessageId)
Returns an immutable instance of BetaMessageThreadParam whose ofContinue variant is built from the given required previousMessageId.
-
-
-
-