Ottieni consigli
Recupera lo stato e i risultati di una raccomandazione. Esegui il polling di questa operazione finché la raccomandazione non raggiunge uno stato terminale (COMPLETEDoFAILED).
Esempi di codice
Esempio
Parametri della richiesta
| Parametro | Tipo | Campo obbligatorio | Descrizione |
|---|---|---|---|
|
|
Stringa |
Sì |
L'ID di raccomandazione restituito da |
Risposta
| Campo | Tipo | Description |
|---|---|---|
|
|
Stringa |
Identificatore univoco per la raccomandazione. |
|
|
Stringa |
ARN della raccomandazione. |
|
|
Stringa |
Il nome della raccomandazione. |
|
|
Stringa |
|
|
|
Stringa |
Stato attuale: |
|
|
Oggetto |
La configurazione che hai inviato. |
|
|
Oggetto |
Presente quando lo stato è |
|
|
Time stamp |
Quando è stata creata la raccomandazione. |
|
|
Time stamp |
Data dell'ultimo aggiornamento della raccomandazione. |
Campi dei risultati del prompt di sistema
Presente recommendationResult.systemPromptRecommendationResult quando il tipo èSYSTEM_PROMPT_RECOMMENDATION:
| Campo | Tipo | Description |
|---|---|---|
|
|
Stringa |
Il testo ottimizzato del prompt di sistema. |
|
|
Oggetto |
Presente quando l'input era un pacchetto di configurazione. Contiene |
|
|
Stringa |
Una spiegazione del motivo per cui è stata generata la raccomandazione e del motivo alla base delle modifiche suggerite. |
|
|
Stringa |
Presente in caso di fallimento. Codice di errore. |
|
|
Stringa |
Presente in caso di fallimento. Human-readable descrizione. |
Descrizione dello strumento, campi dei risultati
Presente recommendationResult.toolDescriptionRecommendationResult quando il tipo èTOOL_DESCRIPTION_RECOMMENDATION:
| Campo | Tipo | Description |
|---|---|---|
|
|
List |
Per-tool risultati. Ogni voce contiene |
|
|
Oggetto |
Presente quando l'input era un pacchetto di configurazione. Contiene |
|
|
Stringa |
Presente in caso di fallimento. Codice di errore. |
|
|
Stringa |
Presente in caso di fallimento. Human-readable descrizione. |
Risposte di esempio
Raccomandazione del prompt di sistema completata (input in linea):
{ "recommendationId": "MyPromptRec-Ab1Cd2Ef3G", "recommendationArn": "arn:aws:bedrock-agentcore:us-west-2:123456789012:recommendation/MyPromptRec-Ab1Cd2Ef3G", "name": "my-prompt-rec", "type": "SYSTEM_PROMPT_RECOMMENDATION", "status": "COMPLETED", "recommendationConfig": { ... }, "recommendationResult": { "systemPromptRecommendationResult": { "recommendedSystemPrompt": "<optimized system prompt text>", "explanation": "<explanation of why the recommendation was generated>" } }, "createdAt": "2025-03-15T10:00:00Z", "updatedAt": "2025-03-15T10:05:30Z" }
Raccomandazione completata del prompt di sistema (input del pacchetto di configurazione):
{ "recommendationId": "MyBundleRec-Xy9Zw8Vq1R", "recommendationArn": "arn:aws:bedrock-agentcore:us-west-2:123456789012:recommendation/MyBundleRec-Xy9Zw8Vq1R", "name": "my-bundle-prompt-rec", "type": "SYSTEM_PROMPT_RECOMMENDATION", "status": "COMPLETED", "recommendationConfig": { ... }, "recommendationResult": { "systemPromptRecommendationResult": { "recommendedSystemPrompt": "<optimized system prompt text>", "configurationBundle": { "bundleArn": "arn:aws:bedrock-agentcore:us-west-2:123456789012:configuration-bundle/myBundle-Ab1Cd2Ef3G", "versionId": "12345678-1234-1234-1234-123456789012" }, "explanation": "<explanation of why the recommendation was generated>" } }, "createdAt": "2025-03-15T10:00:00Z", "updatedAt": "2025-03-15T10:06:12Z" }
Raccomandazione completa sulla descrizione dell'utensile:
{ "recommendationId": "MyToolRec-Qr5St6Uv7W", "recommendationArn": "arn:aws:bedrock-agentcore:us-west-2:123456789012:recommendation/MyToolRec-Qr5St6Uv7W", "name": "my-tool-rec", "type": "TOOL_DESCRIPTION_RECOMMENDATION", "status": "COMPLETED", "recommendationConfig": { ... }, "recommendationResult": { "toolDescriptionRecommendationResult": { "tools": [ { "toolName": "<tool-name-1>", "recommendedToolDescription": "<optimized description for tool 1>", "explanation": "<explanation of why this tool description was changed>" }, { "toolName": "<tool-name-2>", "recommendedToolDescription": "<optimized description for tool 2>", "explanation": "<explanation of why this tool description was changed>" } ] } }, "createdAt": "2025-03-15T11:00:00Z", "updatedAt": "2025-03-15T11:04:45Z" }
Raccomandazione non riuscita:
{ "recommendationId": "MyFailedRec-Mn3Op4Qr5S", "recommendationArn": "arn:aws:bedrock-agentcore:us-west-2:123456789012:recommendation/MyFailedRec-Mn3Op4Qr5S", "name": "my-failed-rec", "type": "SYSTEM_PROMPT_RECOMMENDATION", "status": "FAILED", "recommendationConfig": { ... }, "recommendationResult": { "systemPromptRecommendationResult": { "errorCode": "<error-code>", "errorMessage": "<human-readable error description>" } }, "createdAt": "2025-03-15T12:00:00Z", "updatedAt": "2025-03-15T12:01:10Z" }
Errori
| Errore | Stato HTTP | Description |
|---|---|---|
|
|
404 |
Nessuna raccomandazione trovata con l'ID specificato. |
|
|
400 |
Formato ID di raccomandazione non valido. |
|
|
403 |
Autorizzazioni insufficienti. |
|
|
429 |
Frequenza di richiesta superata. |
|
|
500 |
Service-side errore. |