ツールと確認¶
ツールはLLMの外で安全に実行されます。
実装手順¶
llm.Toolでスキーマ定義。llm.ToolRegistryを実装。- リスクが高いなら確認を有効化。
- タイムアウトとリトライを設定。
重要なデフォルト¶
tools.timeout_mstools.retriestools.serialize_by_streamconfirmation.mode
例¶
llm.Tool{
Name: "schedule_visit",
Description: "Schedule a technician visit.",
RequiresConfirmation: true,
ConfirmationPromptByLanguage: map[string]string{
"id": "Sebelum saya jadwalkan kunjungan, apakah Anda ingin saya lanjutkan?",
"en": "Before I schedule the visit, do you want me to proceed?",
},
Schema: map[string]any{
"type": "object",
"properties": map[string]any{
"location": map[string]any{"type": "string"},
"preferred_time": map[string]any{"type": "string"},
},
"required": []string{"location", "preferred_time"},
},
}
確認¶
- DTMF:
1= yes,2= no。 - キーワードは英語/インドネシア語対応。
- 曖昧な場合のみ
confirmation.llm_fallbackを有効化。