Tool Calling: Don't try to parse if tool calling is not supported

This commit is contained in:
Cohee 2024-10-09 10:49:02 +00:00
parent e7fe218810
commit 3fd7ca90ed

View File

@ -365,6 +365,9 @@ export class ToolManager {
* @returns {void}
*/
static parseToolCalls(toolCalls, parsed) {
if (!this.isToolCallingSupported()) {
return;
}
if (Array.isArray(parsed?.choices)) {
for (const choice of parsed.choices) {
const choiceIndex = (typeof choice.index === 'number') ? choice.index : null;