ai 3.1.3 → 3.1.4

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
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
1
7
  // core/generate-object/generate-object.ts
2
8
  import { NoObjectGeneratedError } from "@ai-sdk/provider";
3
9
  import { safeParseJSON } from "@ai-sdk/provider-utils";
@@ -2389,6 +2395,30 @@ function InkeepStream(res, callbacks) {
2389
2395
  );
2390
2396
  }
2391
2397
 
2398
+ // streams/langchain-adapter.ts
2399
+ var langchain_adapter_exports = {};
2400
+ __export(langchain_adapter_exports, {
2401
+ toAIStream: () => toAIStream
2402
+ });
2403
+ function toAIStream(stream, callbacks) {
2404
+ return stream.pipeThrough(
2405
+ new TransformStream({
2406
+ transform: async (chunk, controller) => {
2407
+ if (typeof chunk.content === "string") {
2408
+ controller.enqueue(chunk.content);
2409
+ } else {
2410
+ const content = chunk.content;
2411
+ for (const item of content) {
2412
+ if (item.type === "text") {
2413
+ controller.enqueue(item.text);
2414
+ }
2415
+ }
2416
+ }
2417
+ }
2418
+ })
2419
+ ).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(createStreamDataTransformer());
2420
+ }
2421
+
2392
2422
  // streams/langchain-stream.ts
2393
2423
  function LangChainStream(callbacks) {
2394
2424
  const stream = new TransformStream();
@@ -3015,6 +3045,7 @@ export {
3015
3045
  InvalidResponseDataError,
3016
3046
  InvalidToolArgumentsError2 as InvalidToolArgumentsError,
3017
3047
  JSONParseError,
3048
+ langchain_adapter_exports as LangChainAdapter,
3018
3049
  LangChainStream,
3019
3050
  LoadAPIKeyError,
3020
3051
  MistralStream,