

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 非同步工具呼叫
<a name="sonic-async-tools"></a>

與 AI 無提示等待工具結果的傳統同步工具呼叫不同，Amazon Nova 2 Sonic 的非同步方法允許它：
+ 在工具執行時繼續接受使用者輸入
+ 回應新問題，無需等待工具結果
+ 同時處理多個工具呼叫
+ 維持自然的對話流程，避免尷尬的暫停
+ 不需要額外的組態。非同步工具呼叫可立即運作。

## 運作方式
<a name="sonic-async-tools-works"></a>

當 Nova 2 Sonic 發出工具呼叫時，不會暫停對話。相反地，它會繼續自然地接聽和回應，直到工具送達。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/nova/latest/nova2-userguide/images/Asynchronous-Tool-Calling_6.png)


## 處理使用者中斷
<a name="sonic-async-tools-interruptions"></a>

如果使用者在工具執行時變更其請求，Nova 2 Sonic 會以智慧方式處理它，而不會取消待定的工具呼叫。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/nova/latest/nova2-userguide/images/Asynchronous-User-Interruption_7.png)


範例藍本

```
User: "Can I book a flight from Boston to Chicago?"
                Agent: "Sure, let me look that up for you."
                Agent: [initiates tool call for Chicago flights]
                User: "Actually, I want to go to Seattle"
                Agent: "Ok let me update that search"
                Agent: [initiates tool call for Seattle flights]
                [First tool returns with Chicago flight results]
                Agent: [receives Chicago results and processes them contextually]
```

## 運作方式
<a name="sonic-async-tools-how-it-works"></a>

工具結果一律會交付：工具呼叫完成時，其結果一律會傳送至模型，即使使用者已變更其請求也一樣。模型會使用其推理功能來判斷如何處理資訊。

內容感知處理：模型了解對話內容，並可適當處理過時的工具結果。例如：
+ 如果使用者在改變主意後說「謝謝」，則模型仍需要原始結果做為內容
+ 如果使用者變更其請求，模型可以確認原始結果，同時專注於新的請求

無自動取消：系統不會根據新使用者輸入自動取消或忽略工具呼叫。這可確保模型擁有完整的資訊，以做出有關如何回應的明智決策。