UNPKG

call-ai

Version:

Lightweight library for making AI API calls with streaming support

22 lines 669 B
const responseMetadata = new WeakMap(); const stringResponseMap = new Map(); function boxString(str) { if (stringResponseMap.has(str)) { return stringResponseMap.get(str); } const box = Object.create(null); stringResponseMap.set(str, box); return box; } function getMeta(response) { if (typeof response === "string") { const box = stringResponseMap.get(response); if (box) { return responseMetadata.get(box); } return undefined; } return responseMetadata.get(response); } export { responseMetadata, stringResponseMap, boxString, getMeta }; //# sourceMappingURL=response-metadata.js.map