Class BetaDream
-
- All Implemented Interfaces:
public final class BetaDreamAn asynchronous job that reads a memory store and past sessions, then writes a reorganized version of that memory store.
By default the dream writes its result to a new memory store and doesn't change the input memory store. With
output_behaviorset toupdate_existing, it writes its result into the input memory store instead.The Dreams API is in research preview: the request and response shapes are volatile and may change without the deprecation period that applies to stable endpoints.
See the Dreams guide for what a dream reads and produces.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classBetaDream.BuilderA builder for BetaDream.
-
Method Summary
Modifier and Type Method Description final Stringid()The unique ID of the dream ( drm_...).final Optional<OffsetDateTime>archivedAt()When the dream was archived, in RFC 3339, or nullif it hasn't been archived.final OffsetDateTimecreatedAt()When the dream was created, in RFC 3339. final Optional<OffsetDateTime>endedAt()When the dream reached completed,failed, orcanceled, in RFC 3339, ornullif it is stillpendingorrunning.final Optional<BetaDreamError>error()Why the dream failed, or nullifstatusisn'tfailed.final List<BetaDreamInput>inputs()The sources that the dream reads, from the request that created it. final Optional<String>instructions()The guidance given when the dream was created, or nullif none was given.final BetaDreamModelConfigmodel()The model that runs a dream, from the request that created it. final BetaOutputBehavioroutputBehavior()Where the dream writes its result, as set in the request that created the dream. final List<BetaDreamOutput>outputs()The memory store that holds the dream's result, as a one-item array, or an empty array until the dream records that memory store. final Optional<String>sessionId()The ID of the session that runs the dream ( sesn_...), ornullif that session hasn't started.final BetaDreamStatusstatus()Where a dream is in its lifecycle. final BetaDreamUsageusage()The dream's token counts, which stop changing once its statusiscompletedorfailed.final JsonValue_type()Expected to always return the following:
However, this method can be useful for debugging and logging (e.g.JsonValue.from("dream")final JsonField<String>_id()Returns the raw JSON value of id. final JsonField<OffsetDateTime>_archivedAt()Returns the raw JSON value of archivedAt. final JsonField<OffsetDateTime>_createdAt()Returns the raw JSON value of createdAt. final JsonField<OffsetDateTime>_endedAt()Returns the raw JSON value of endedAt. final JsonField<BetaDreamError>_error()Returns the raw JSON value of error. final JsonField<List<BetaDreamInput>>_inputs()Returns the raw JSON value of inputs. final JsonField<String>_instructions()Returns the raw JSON value of instructions. final JsonField<BetaDreamModelConfig>_model()Returns the raw JSON value of model. final JsonField<BetaOutputBehavior>_outputBehavior()Returns the raw JSON value of outputBehavior. final JsonField<List<BetaDreamOutput>>_outputs()Returns the raw JSON value of outputs. final JsonField<String>_sessionId()Returns the raw JSON value of sessionId. final JsonField<BetaDreamStatus>_status()Returns the raw JSON value of status. final JsonField<BetaDreamUsage>_usage()Returns the raw JSON value of usage. final Map<String, JsonValue>_additionalProperties()final BetaDream.BuildertoBuilder()final BetaDreamvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaDream.Builderbuilder()Returns a mutable builder for constructing an instance of BetaDream. -
-
Method Detail
-
archivedAt
final Optional<OffsetDateTime> archivedAt()
When the dream was archived, in RFC 3339, or
nullif it hasn't been archived.
-
createdAt
final OffsetDateTime createdAt()
When the dream was created, in RFC 3339.
Lists of dreams are sorted by this time, newest first.
-
endedAt
final Optional<OffsetDateTime> endedAt()
When the dream reached
completed,failed, orcanceled, in RFC 3339, ornullif it is stillpendingorrunning.
-
error
final Optional<BetaDreamError> error()
Why the dream failed, or
nullifstatusisn'tfailed.
-
inputs
final List<BetaDreamInput> inputs()
The sources that the dream reads, from the request that created it.
-
instructions
final Optional<String> instructions()
The guidance given when the dream was created, or
nullif none was given.
-
model
final BetaDreamModelConfig model()
The model that runs a dream, from the request that created it.
The dream uses this model for all of its work. The response always gives the model as an object, even if the request gave only a model ID.
-
outputBehavior
final BetaOutputBehavior outputBehavior()
Where the dream writes its result, as set in the request that created the dream. If that request left out
output_behavior, the dream used thecreate_newbehavior.
-
outputs
final List<BetaDreamOutput> outputs()
The memory store that holds the dream's result, as a one-item array, or an empty array until the dream records that memory store.
The array is empty while the dream is
pendingand for a short time after it startsrunning. It can stay empty if the dream fails or is canceled before then. The memory store holds the complete result only oncestatusiscompleted.See the Dreams guide for how to review and use the result.
-
sessionId
final Optional<String> sessionId()
The ID of the session that runs the dream (
sesn_...), ornullif that session hasn't started.Stream that session's events to follow what the dream reads and writes.
See the Dreams guide for how to watch a running dream.
-
status
final BetaDreamStatus status()
Where a dream is in its lifecycle.
completed,failed, andcanceledare final: once a dream has one of these statuses, its status doesn't change again.See the Dreams guide for what each status means.
-
usage
final BetaDreamUsage usage()
The dream's token counts, which stop changing once its
statusiscompletedorfailed. After a cancel, they can keep changing.
-
_type
final JsonValue _type()
Expected to always return the following:
JsonValue.from("dream")However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
_id
final JsonField<String> _id()
Returns the raw JSON value of id.
Unlike id, this method doesn't throw if the JSON field has an unexpected type.
-
_archivedAt
final JsonField<OffsetDateTime> _archivedAt()
Returns the raw JSON value of archivedAt.
Unlike archivedAt, this method doesn't throw if the JSON field has an unexpected type.
-
_createdAt
final JsonField<OffsetDateTime> _createdAt()
Returns the raw JSON value of createdAt.
Unlike createdAt, this method doesn't throw if the JSON field has an unexpected type.
-
_endedAt
final JsonField<OffsetDateTime> _endedAt()
Returns the raw JSON value of endedAt.
Unlike endedAt, this method doesn't throw if the JSON field has an unexpected type.
-
_error
final JsonField<BetaDreamError> _error()
Returns the raw JSON value of error.
Unlike error, this method doesn't throw if the JSON field has an unexpected type.
-
_inputs
final JsonField<List<BetaDreamInput>> _inputs()
Returns the raw JSON value of inputs.
Unlike inputs, this method doesn't throw if the JSON field has an unexpected type.
-
_instructions
final JsonField<String> _instructions()
Returns the raw JSON value of instructions.
Unlike instructions, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<BetaDreamModelConfig> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_outputBehavior
final JsonField<BetaOutputBehavior> _outputBehavior()
Returns the raw JSON value of outputBehavior.
Unlike outputBehavior, this method doesn't throw if the JSON field has an unexpected type.
-
_outputs
final JsonField<List<BetaDreamOutput>> _outputs()
Returns the raw JSON value of outputs.
Unlike outputs, this method doesn't throw if the JSON field has an unexpected type.
-
_sessionId
final JsonField<String> _sessionId()
Returns the raw JSON value of sessionId.
Unlike sessionId, this method doesn't throw if the JSON field has an unexpected type.
-
_status
final JsonField<BetaDreamStatus> _status()
Returns the raw JSON value of status.
Unlike status, this method doesn't throw if the JSON field has an unexpected type.
-
_usage
final JsonField<BetaDreamUsage> _usage()
Returns the raw JSON value of usage.
Unlike usage, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final BetaDream.Builder toBuilder()
-
validate
final BetaDream 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.
-
builder
final static BetaDream.Builder builder()
Returns a mutable builder for constructing an instance of BetaDream.
The following fields are required:
.id() .archivedAt() .createdAt() .endedAt() .error() .inputs() .instructions() .model() .outputBehavior() .outputs() .sessionId() .status() .usage()
-
-
-
-