Создать сон
POST/v1/dreams
Запускает асинхронное задание, которое использует прошлые сеансы для создания реорганизованной версии хранилища памяти, и возвращает «dream» (сон), который можно опрашивать для получения результата.
По умолчанию сон записывает результат в новое хранилище памяти и не изменяет входное хранилище памяти. В ответе status имеет значение pending, а массив outputs пуст. Опрашивайте сон, пока status не примет значение completed, failed или canceled.
Подробнее о создании снов см. в руководстве по снам (Dreams).
Parameters
Returns
Создать сон
package com.anthropic.example;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.dreams.BetaDream;
import com.anthropic.models.beta.dreams.DreamCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
AnthropicClient client = AnthropicOkHttpClient.fromEnv();
DreamCreateParams params = DreamCreateParams.builder()
.addMemoryStoreInput("x")
.model("string")
.build();
BetaDream betaDream = client.beta().dreams().create(params);
}
}Response 200
{
"id": "id",
"archived_at": "2019-12-27T18:11:19.117Z",
"created_at": "2019-12-27T18:11:19.117Z",
"ended_at": "2019-12-27T18:11:19.117Z",
"error": {
"message": "message",
"type": "type"
},
"inputs": [
{
"memory_store_id": "x",
"type": "memory_store"
}
],
"instructions": "instructions",
"model": {
"id": "x",
"speed": "standard"
},
"output_behavior": {
"type": "create_new"
},
"outputs": [
{
"memory_store_id": "memory_store_id",
"type": "memory_store"
}
],
"session_id": "session_id",
"status": "pending",
"type": "dream",
"usage": {
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"input_tokens": 0,
"output_tokens": 0
}
}Returns Examples
Response 200
{
"id": "id",
"archived_at": "2019-12-27T18:11:19.117Z",
"created_at": "2019-12-27T18:11:19.117Z",
"ended_at": "2019-12-27T18:11:19.117Z",
"error": {
"message": "message",
"type": "type"
},
"inputs": [
{
"memory_store_id": "x",
"type": "memory_store"
}
],
"instructions": "instructions",
"model": {
"id": "x",
"speed": "standard"
},
"output_behavior": {
"type": "create_new"
},
"outputs": [
{
"memory_store_id": "memory_store_id",
"type": "memory_store"
}
],
"session_id": "session_id",
"status": "pending",
"type": "dream",
"usage": {
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"input_tokens": 0,
"output_tokens": 0
}
}