ForcedFunctionName 当 tool_choice 强制某个具名工具时返回它的名字; 否则返回 ""(auto / none / any / nil)。
()
| 123 | // ForcedFunctionName 当 tool_choice 强制某个具名工具时返回它的名字; |
| 124 | // 否则返回 ""(auto / none / any / nil)。 |
| 125 | func (t *ToolChoice) ForcedFunctionName() string { |
| 126 | if t == nil { |
| 127 | return "" |
| 128 | } |
| 129 | if t.Type == "function" && t.Function != nil { |
| 130 | return t.Function.Name |
| 131 | } |
| 132 | return "" |
| 133 | } |
| 134 | |
| 135 | // IsForcedNone 报告 tool_choice 是否显式禁止调用工具。 |
| 136 | func (t *ToolChoice) IsForcedNone() bool { |