( toolCalls []fantasy.ToolCallContent, exclusiveToolNames map[string]bool, blockingToolName string, )
| 1498 | } |
| 1499 | |
| 1500 | func exclusiveToolPolicyResults( |
| 1501 | toolCalls []fantasy.ToolCallContent, |
| 1502 | exclusiveToolNames map[string]bool, |
| 1503 | blockingToolName string, |
| 1504 | ) []fantasy.ToolResultContent { |
| 1505 | results := make([]fantasy.ToolResultContent, len(toolCalls)) |
| 1506 | for i, tc := range toolCalls { |
| 1507 | message := exclusiveToolSkippedErrorMessage(blockingToolName) |
| 1508 | if exclusiveToolNames[tc.ToolName] { |
| 1509 | message = exclusiveToolMustRunAloneErrorMessage(tc.ToolName) |
| 1510 | } |
| 1511 | results[i] = fantasy.ToolResultContent{ |
| 1512 | ToolCallID: tc.ToolCallID, |
| 1513 | ToolName: tc.ToolName, |
| 1514 | Result: fantasy.ToolResultOutputContentError{ |
| 1515 | Error: xerrors.New(message), |
| 1516 | }, |
| 1517 | } |
| 1518 | } |
| 1519 | return results |
| 1520 | } |
| 1521 | |
| 1522 | func exclusiveToolMustRunAloneErrorMessage(toolName string) string { |
| 1523 | return toolName + " must be called alone, without other tools in the same batch. Retry with only the " + toolName + " call." |
no test coverage detected