Class: Anthropic::Resources::Beta::Dreams
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Dreams
- Defined in:
- lib/anthropic/resources/beta/dreams.rb,
sig/anthropic/resources/beta/dreams.rbs
Instance Method Summary collapse
-
#archive(dream_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream
Hide a
completed,failed, orcanceleddream from the default list of dreams. -
#cancel(dream_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream
Stop a
pendingorrunningdream. -
#create(inputs:, model:, instructions: nil, output_behavior: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream
Start an asynchronous job that uses past sessions to produce a reorganized version of a memory store and get back the dream to poll for the result.
-
#initialize(client:) ⇒ Dreams
constructor
private
A new instance of Dreams.
-
#list(created_at_gt: nil, created_at_lt: nil, include_archived: nil, limit: nil, page: nil, statuses: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::BetaDream>
List the dreams in the workspace, newest first.
-
#retrieve(dream_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream
Get a dream by ID to check its status, output memory store, and token usage.
Constructor Details
#initialize(client:) ⇒ Dreams
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Dreams.
220 221 222 |
# File 'lib/anthropic/resources/beta/dreams.rb', line 220 def initialize(client:) @client = client end |
Instance Method Details
#archive(dream_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream
Hide a completed, failed, or canceled dream from the default list of
dreams.
Archiving a pending or running dream returns a 400 error, so cancel it
first. Archiving an archived dream returns it unchanged. An archived dream can
still be fetched by ID. Archiving can't be undone.
See the Dreams guide to learn more about archiving dreams.
Some parameter documentations has been truncated, see Models::Beta::DreamArchiveParams for more details.
168 169 170 171 172 173 174 175 176 177 |
# File 'lib/anthropic/resources/beta/dreams.rb', line 168 def archive(dream_id, params = {}) parsed, = Anthropic::Beta::DreamArchiveParams.dump_request(params) @client.request( method: :post, path: ["v1/dreams/%1$s/archive?beta=true", dream_id], headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"), model: Anthropic::Beta::BetaDream, options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **} ) end |
#cancel(dream_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream
Stop a pending or running dream.
The response shows status as canceled, unless the dream reached completed
or failed first. usage can keep changing after the response. Canceling a
canceled dream returns it unchanged. Canceling a completed or failed dream
returns a 400 error.
See the Dreams guide to learn more about canceling dreams.
Some parameter documentations has been truncated, see Models::Beta::DreamCancelParams for more details.
206 207 208 209 210 211 212 213 214 215 |
# File 'lib/anthropic/resources/beta/dreams.rb', line 206 def cancel(dream_id, params = {}) parsed, = Anthropic::Beta::DreamCancelParams.dump_request(params) @client.request( method: :post, path: ["v1/dreams/%1$s/cancel?beta=true", dream_id], headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"), model: Anthropic::Beta::BetaDream, options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **} ) end |
#create(inputs:, model:, instructions: nil, output_behavior: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream
Start an asynchronous job that uses past sessions to produce a reorganized version of a memory store and get back the dream to poll for the result.
By default the dream writes its result to a new memory store and doesn't change
the input memory store. The response has status set to pending and an empty
outputs array. Poll the dream until status is completed, failed, or
canceled.
See the Dreams guide to learn more about creating dreams.
Some parameter documentations has been truncated, see Models::Beta::DreamCreateParams for more details.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/anthropic/resources/beta/dreams.rb', line 41 def create(params) parsed, = Anthropic::Beta::DreamCreateParams.dump_request(params) header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"} @client.request( method: :post, path: "v1/dreams?beta=true", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Anthropic::Beta::BetaDream, options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **} ) end |
#list(created_at_gt: nil, created_at_lt: nil, include_archived: nil, limit: nil, page: nil, statuses: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::BetaDream>
List the dreams in the workspace, newest first.
Archived dreams are left out unless include_archived is true.
See the Dreams guide for how to page through dreams.
Some parameter documentations has been truncated, see Models::Beta::DreamListParams for more details.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/anthropic/resources/beta/dreams.rb', line 123 def list(params = {}) query_params = [:created_at_gt, :created_at_lt, :include_archived, :limit, :page, :statuses] parsed, = Anthropic::Beta::DreamListParams.dump_request(params) query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "v1/dreams?beta=true", query: query.transform_keys(created_at_gt: "created_at[gt]", created_at_lt: "created_at[lt]"), headers: parsed.except(*query_params).transform_keys( betas: "anthropic-beta", workspace_id: "anthropic-workspace-id" ), page: Anthropic::Internal::PageCursor, model: Anthropic::Beta::BetaDream, options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **} ) end |
#retrieve(dream_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaDream
Get a dream by ID to check its status, output memory store, and token usage.
Archived dreams are returned too.
See the Dreams guide for how to poll a dream and what each status means.
Some parameter documentations has been truncated, see Models::Beta::DreamRetrieveParams for more details.
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/anthropic/resources/beta/dreams.rb', line 78 def retrieve(dream_id, params = {}) parsed, = Anthropic::Beta::DreamRetrieveParams.dump_request(params) @client.request( method: :get, path: ["v1/dreams/%1$s?beta=true", dream_id], headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"), model: Anthropic::Beta::BetaDream, options: {extra_headers: {"anthropic-beta" => "dreaming-2026-04-21"}, **} ) end |