ai 3.2.38 → 3.2.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3412,7 +3412,8 @@ function InkeepStream(res, callbacks) {
3412
3412
  var langchain_adapter_exports = {};
3413
3413
  __export(langchain_adapter_exports, {
3414
3414
  toAIStream: () => toAIStream,
3415
- toDataStream: () => toDataStream
3415
+ toDataStream: () => toDataStream,
3416
+ toDataStreamResponse: () => toDataStreamResponse
3416
3417
  });
3417
3418
  function toAIStream(stream, callbacks) {
3418
3419
  return toDataStream(stream, callbacks);
@@ -3440,6 +3441,21 @@ function toDataStream(stream, callbacks) {
3440
3441
  })
3441
3442
  ).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(createStreamDataTransformer());
3442
3443
  }
3444
+ function toDataStreamResponse(stream, options) {
3445
+ var _a;
3446
+ const dataStream = toDataStream(stream, options == null ? void 0 : options.callbacks);
3447
+ const data = options == null ? void 0 : options.data;
3448
+ const init = options == null ? void 0 : options.init;
3449
+ const responseStream = data ? mergeStreams(data.stream, dataStream) : dataStream;
3450
+ return new Response(responseStream, {
3451
+ status: (_a = init == null ? void 0 : init.status) != null ? _a : 200,
3452
+ statusText: init == null ? void 0 : init.statusText,
3453
+ headers: prepareResponseHeaders(init, {
3454
+ contentType: "text/plain; charset=utf-8",
3455
+ dataStreamVersion: "v1"
3456
+ })
3457
+ });
3458
+ }
3443
3459
  function forwardAIMessageChunk(chunk, controller) {
3444
3460
  if (typeof chunk.content === "string") {
3445
3461
  controller.enqueue(chunk.content);