jorel
Version:
The easiest way to use LLMs, including streams, images, documents, tools and various agent scenarios.
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;