ai 3.2.16 → 3.2.18

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/README.md CHANGED
@@ -49,7 +49,7 @@ main();
49
49
 
50
50
  The [AI SDK UI](https://sdk.vercel.ai/docs/ai-sdk-ui/overview) module provides a set of hooks that help you build chatbots and generative user interfaces. These hooks are framework agnostic, so they can be used in Next.js, React, Svelte, Vue, and SolidJS.
51
51
 
52
- ###### @/app/page.tsx (Next.js Pages Router)
52
+ ###### @/app/page.tsx (Next.js App Router)
53
53
 
54
54
  ```tsx
55
55
  "use client"
@@ -81,7 +81,7 @@ export default function Page() {
81
81
  }
82
82
  ```
83
83
 
84
- ###### @/app/api/chat/route.ts (Next.js Pages Router)
84
+ ###### @/app/api/chat/route.ts (Next.js App Router)
85
85
 
86
86
  ```ts
87
87
  import { CoreMessage, streamText } from 'ai';
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DeepPartial, JSONValue, CreateMessage, FunctionCall as FunctionCall$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
2
2
  export { AssistantMessage, AssistantStatus, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DeepPartial, Function, FunctionCall, FunctionCallHandler, IdGenerator, JSONValue, Message, RequestOptions, StreamPart, Tool, ToolCall, ToolCallHandler, ToolChoice, ToolInvocation, UseAssistantOptions, formatStreamPart, parseComplexResponse, parseStreamPart, readDataStream } from '@ai-sdk/ui-utils';
3
- import { EmbeddingModelV1, EmbeddingModelV1Embedding, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning } from '@ai-sdk/provider';
3
+ import { EmbeddingModelV1, EmbeddingModelV1Embedding, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning, LanguageModelV1StreamPart } from '@ai-sdk/provider';
4
4
  export { APICallError, EmptyResponseBodyError, InvalidArgumentError, InvalidDataContentError, InvalidPromptError, InvalidResponseDataError, InvalidToolArgumentsError, JSONParseError, LoadAPIKeyError, NoObjectGeneratedError, NoSuchToolError, RetryError, ToolCallParseError, TypeValidationError, UnsupportedFunctionalityError, UnsupportedJSONSchemaError } from '@ai-sdk/provider';
5
5
  import { z } from 'zod';
6
6
  import { ServerResponse } from 'http';
@@ -695,7 +695,7 @@ declare class StreamObjectResult<T> {
695
695
  headers?: Record<string, string>;
696
696
  };
697
697
  constructor({ stream, warnings, rawResponse, schema, onFinish, }: {
698
- stream: ReadableStream<string | ObjectStreamInputPart>;
698
+ stream: ReadableStream<string | Omit<LanguageModelV1StreamPart, 'text-delta'>>;
699
699
  warnings: CallWarning[] | undefined;
700
700
  rawResponse?: {
701
701
  headers?: Record<string, string>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DeepPartial, JSONValue, CreateMessage, FunctionCall as FunctionCall$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
2
2
  export { AssistantMessage, AssistantStatus, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DeepPartial, Function, FunctionCall, FunctionCallHandler, IdGenerator, JSONValue, Message, RequestOptions, StreamPart, Tool, ToolCall, ToolCallHandler, ToolChoice, ToolInvocation, UseAssistantOptions, formatStreamPart, parseComplexResponse, parseStreamPart, readDataStream } from '@ai-sdk/ui-utils';
3
- import { EmbeddingModelV1, EmbeddingModelV1Embedding, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning } from '@ai-sdk/provider';
3
+ import { EmbeddingModelV1, EmbeddingModelV1Embedding, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning, LanguageModelV1StreamPart } from '@ai-sdk/provider';
4
4
  export { APICallError, EmptyResponseBodyError, InvalidArgumentError, InvalidDataContentError, InvalidPromptError, InvalidResponseDataError, InvalidToolArgumentsError, JSONParseError, LoadAPIKeyError, NoObjectGeneratedError, NoSuchToolError, RetryError, ToolCallParseError, TypeValidationError, UnsupportedFunctionalityError, UnsupportedJSONSchemaError } from '@ai-sdk/provider';
5
5
  import { z } from 'zod';
6
6
  import { ServerResponse } from 'http';
@@ -695,7 +695,7 @@ declare class StreamObjectResult<T> {
695
695
  headers?: Record<string, string>;
696
696
  };
697
697
  constructor({ stream, warnings, rawResponse, schema, onFinish, }: {
698
- stream: ReadableStream<string | ObjectStreamInputPart>;
698
+ stream: ReadableStream<string | Omit<LanguageModelV1StreamPart, 'text-delta'>>;
699
699
  warnings: CallWarning[] | undefined;
700
700
  rawResponse?: {
701
701
  headers?: Record<string, string>;
package/dist/index.js CHANGED
@@ -484,6 +484,16 @@ function getValidatedPrompt(prompt) {
484
484
  message: "prompt and messages cannot be defined at the same time"
485
485
  });
486
486
  }
487
+ if (prompt.messages != null) {
488
+ for (const message of prompt.messages) {
489
+ if (message.role === "system" && typeof message.content !== "string") {
490
+ throw new import_provider3.InvalidPromptError({
491
+ prompt,
492
+ message: "system message content must be a string"
493
+ });
494
+ }
495
+ }
496
+ }
487
497
  return prompt.prompt != null ? {
488
498
  type: "prompt",
489
499
  prompt: prompt.prompt,