UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

32 lines 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageFormatter = void 0; class MessageFormatter { static formatToolResult(result) { if (typeof result === 'object' && result !== null) { return { content: [{ type: 'text', text: JSON.stringify(result) }] }; } if (typeof result === 'string') { return { content: [{ type: 'text', text: result }] }; } if (result === null || result === undefined) { return { content: [{ type: 'text', text: String(result) }] }; } if (typeof result === 'number' || typeof result === 'boolean' || typeof result === 'bigint') { return { content: [{ type: 'text', text: result.toString() }] }; } return { content: [ { type: 'text', text: String(result) }, ], }; } static formatError(error) { return { isError: true, content: [{ type: 'text', text: `${error.name}: ${error.message}` }], }; } } exports.MessageFormatter = MessageFormatter; //# sourceMappingURL=MessageFormatter.js.map