@langchain/core
Version:
Core LangChain.js abstractions and schemas
8 lines (7 loc) • 438 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.charChunks = void 0;
const index_js_1 = require("../../messages/index.cjs");
/** Tiny helper to convert string into char chunk. For eg: Turn `"Hi!"` into `[AIMessageChunk("H"), AIMessageChunk("i"), AIMessageChunk("!")] */
const charChunks = (text) => [...text].map((c) => new index_js_1.AIMessageChunk({ content: c }));
exports.charChunks = charChunks;
;