UNPKG

@sap-ai-sdk/foundation-models

Version:

SAP Cloud SDK for AI is the official Software Development Kit (SDK) for **SAP AI Core**, **SAP Generative AI Hub**, and **Orchestration Service**.

29 lines 918 B
/** * Parses a batch output JSONL payload into typed output lines. * @param data - The data returned from FileApi.fileDownload(), as a Blob, Buffer, or string. * @returns A Promise resolving to an array of parsed output lines. * @experimental This API is experimental and may change at any time without prior notice. */ export async function parseBatchOutput(data) { let text; if (typeof data === 'string') { text = data; } else if (Buffer.isBuffer(data)) { text = data.toString('utf-8'); } else if (data instanceof Blob) { text = await data.text(); } else { // typeguard - all cases handled data; // let if fail in a natural way text = data; } return text .split('\n') .filter(line => line.trim().length) .map(line => JSON.parse(line)); } //# sourceMappingURL=azure-openai-batch-output.js.map