UNPKG

@maximai/maxim-js

Version:

Maxim AI JS SDK. Visit https://getmaxim.ai for more info.

50 lines 1.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToolCall = void 0; const utils_1 = require("../utils"); const base_1 = require("./base"); const types_1 = require("./types"); class ToolCall extends base_1.BaseContainer { constructor(config, writer) { super(types_1.Entity.TOOL_CALL, config, writer); this.args = config.args; this.description = config.description; } update(data) { this.commit("update", data); } static update_(writer, id, data) { base_1.BaseContainer.commit_(writer, types_1.Entity.TOOL_CALL, id, "update", data); } result(result) { this.commit("result", { result }); this.end(); } static result_(writer, id, result) { base_1.BaseContainer.commit_(writer, types_1.Entity.TOOL_CALL, id, "result", { result }); base_1.BaseContainer.end_(writer, types_1.Entity.TOOL_CALL, id, { endTimestamp: (0, utils_1.utcNow)(), }); } error(error) { this.commit("error", { error }); this.end(); } static error_(writer, id, error) { base_1.BaseContainer.commit_(writer, types_1.Entity.TOOL_CALL, id, "error", { error }); base_1.BaseContainer.end_(writer, types_1.Entity.TOOL_CALL, id, { endTimestamp: (0, utils_1.utcNow)(), }); } data() { const baseData = super.data(); return { ...baseData, name: this._name, description: this.description, args: this.args, }; } } exports.ToolCall = ToolCall; //# sourceMappingURL=toolCall.js.map