UNPKG

@botonic/react

Version:

Build Chatbots using React

28 lines 972 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RETRIEVE_KNOWLEDGE_TOOL = void 0; exports.parseTools = parseTools; exports.RETRIEVE_KNOWLEDGE_TOOL = 'retrieve_knowledge'; function parseTools(tools) { const result = { retrieveKnowledgeTools: [], otherTools: [], allSourcesIds: [], allChunksIds: [], query: undefined, }; for (const tool of tools) { if (tool.tool_name !== exports.RETRIEVE_KNOWLEDGE_TOOL) { result.otherTools.push(tool); continue; } result.retrieveKnowledgeTools.push(tool); if (typeof tool.tool_arguments?.query === 'string') { result.query = tool.tool_arguments.query; } result.allSourcesIds.push(...(tool.knowledgebase_sources_ids ?? [])); result.allChunksIds.push(...(tool.knowledgebase_chunks_ids ?? [])); } return result; } //# sourceMappingURL=parse-tools.js.map