Skip to content

fix(js): Support Uint8Array and Buffer JSONL sources in OpenAI batch instrumentation - #2479

Merged
Luca Forstner (lforst) merged 5 commits into
braintrustdata:mainfrom
Tyagiquamar:fix-openai-batch-uint8array-jsonl-support
Sep 17, 2026
Merged

Luca Forstner (lforst) merged 5 commits into
braintrustdata:mainfrom
Tyagiquamar:fix-openai-batch-uint8array-jsonl-support

Conversation

@Tyagiquamar

Copy link
Copy Markdown
Contributor

Summary

When \jsonlRecords\ receives a resolved file source as a \Uint8Array, \ArrayBuffer, or Node \Buffer\ (for instance, when files are read via \ s.promises.readFile\ or fetched as array buffers), the previous type check \ ypeof resolvedFile === 'string'\ evaluated to false. As a result, the source reached the fallback check where it logged an invalid JSONL source error.

This PR updates \jsonlRecords\ to check for \Uint8Array, \ArrayBuffer, and \Buffer\ instances and decodes byte buffers using \TextDecoder\ so binary-backed JSONL file sources are parsed correctly.

Testing

  • Tested \jsonlRecords\ stream decoding with \Uint8Array\ and \Buffer\ payload inputs.

@lforst Luca Forstner (lforst) changed the title fix(js): support Uint8Array and Buffer JSONL sources in OpenAI batch instrumentation fix(js): Support Uint8Array and Buffer JSONL sources in OpenAI batch instrumentation Sep 17, 2026
@lforst
Luca Forstner (lforst) merged commit e431303 into braintrustdata:main Sep 17, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants