ai 3.1.3 → 3.1.5

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";
@@ -73,6 +79,9 @@ function convertToLanguageModelPrompt(prompt) {
73
79
  languageModelMessages.push(
74
80
  ...prompt.messages.map((message) => {
75
81
  switch (message.role) {
82
+ case "system": {
83
+ return { role: "system", content: message.content };
84
+ }
76
85
  case "user": {
77
86
  if (typeof message.content === "string") {
78
87
  return {
@@ -2389,6 +2398,30 @@ function InkeepStream(res, callbacks) {
2389
2398
  );
2390
2399
  }
2391
2400
 
2401
+ // streams/langchain-adapter.ts
2402
+ var langchain_adapter_exports = {};
2403
+ __export(langchain_adapter_exports, {
2404
+ toAIStream: () => toAIStream
2405
+ });
2406
+ function toAIStream(stream, callbacks) {
2407
+ return stream.pipeThrough(
2408
+ new TransformStream({
2409
+ transform: async (chunk, controller) => {
2410
+ if (typeof chunk.content === "string") {
2411
+ controller.enqueue(chunk.content);
2412
+ } else {
2413
+ const content = chunk.content;
2414
+ for (const item of content) {
2415
+ if (item.type === "text") {
2416
+ controller.enqueue(item.text);
2417
+ }
2418
+ }
2419
+ }
2420
+ }
2421
+ })
2422
+ ).pipeThrough(createCallbacksTransformer(callbacks)).pipeThrough(createStreamDataTransformer());
2423
+ }
2424
+
2392
2425
  // streams/langchain-stream.ts
2393
2426
  function LangChainStream(callbacks) {
2394
2427
  const stream = new TransformStream();
@@ -3015,6 +3048,7 @@ export {
3015
3048
  InvalidResponseDataError,
3016
3049
  InvalidToolArgumentsError2 as InvalidToolArgumentsError,
3017
3050
  JSONParseError,
3051
+ langchain_adapter_exports as LangChainAdapter,
3018
3052
  LangChainStream,
3019
3053
  LoadAPIKeyError,
3020
3054
  MistralStream,