jorel
Version:
A unified wrapper for working with LLMs from multiple providers, including streams, images, documents & automatic tool use.
41 lines (40 loc) • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toolChoiceToVertexAi = void 0;
const vertexai_1 = require("@google-cloud/vertexai");
const toolChoiceToVertexAi = (hasTools, toolChoice) => {
if (!toolChoice) {
return undefined;
}
if (hasTools) {
if (toolChoice === "auto") {
return {
functionCallingConfig: {
mode: vertexai_1.FunctionCallingMode.AUTO,
},
};
}
else if (toolChoice === "required") {
return {
functionCallingConfig: {
mode: vertexai_1.FunctionCallingMode.ANY,
},
};
}
else if (toolChoice === "none") {
return {
functionCallingConfig: {
mode: vertexai_1.FunctionCallingMode.NONE,
},
};
}
else {
return {
functionCallingConfig: {
mode: vertexai_1.FunctionCallingMode.AUTO,
},
};
}
}
};
exports.toolChoiceToVertexAi = toolChoiceToVertexAi;