啟動一個非同步工作,利用過去的工作階段產生記憶儲存區的重新組織版本,並取回 dream 以輪詢結果。
根據預設,dream 會將結果寫入新的記憶儲存區,且不會變更輸入的記憶儲存區。回應中的 status 會設為 pending,且 outputs 陣列為空。請持續輪詢 dream,直到 status 為 completed、failed 或 canceled。
請參閱 Dreams 指南,進一步了解如何建立 dream。
Parameters
Returns
建立 Dream
package main
import (
"context"
"fmt"
"github.com/anthropics/anthropic-sdk-go"
"github.com/anthropics/anthropic-sdk-go/option"
)
func main() {
client := anthropic.NewClient(
option.WithAPIKey("my-anthropic-api-key"),
)
betaDream, err := client.Beta.Dreams.New(context.TODO(), anthropic.BetaDreamNewParams{
Inputs: []anthropic.BetaDreamInputUnionParam{anthropic.BetaDreamInputUnionParam{
OfMemoryStore: &anthropic.BetaDreamMemoryStoreInputParam{
MemoryStoreID: "x",
Type: anthropic.BetaDreamMemoryStoreInputTypeMemoryStore,
},
}},
Model: anthropic.BetaDreamNewParamsModelUnion{
OfString: anthropic.String("string"),
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", betaDream.ID)
}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
}
}