@ai-sdk/ui-utils
Advanced tools
Comparing version 1.1.8 to 1.1.9
# @ai-sdk/ui-utils | ||
## 1.1.9 | ||
### Patch Changes | ||
- 6b8cc14: feat (ai/core): support recursive zod schemas | ||
## 1.1.8 | ||
@@ -4,0 +10,0 @@ |
@@ -690,4 +690,12 @@ import { LanguageModelV1FinishReason, JSONValue as JSONValue$1 } from '@ai-sdk/provider'; | ||
declare function zodSchema<OBJECT>(zodSchema: z.Schema<OBJECT, z.ZodTypeDef, any>): Schema<OBJECT>; | ||
declare function zodSchema<OBJECT>(zodSchema: z.Schema<OBJECT, z.ZodTypeDef, any>, options?: { | ||
/** | ||
* Enables support for references in the schema. | ||
* This is required for recursive schemas, e.g. with `z.lazy`. | ||
* However, not all language models and providers support such references. | ||
* Defaults to `false`. | ||
*/ | ||
useReferences?: boolean; | ||
}): Schema<OBJECT>; | ||
export { type AssistantMessage, type AssistantStatus, type AssistantStreamPart, type AssistantStreamString, type Attachment, type ChatRequest, type ChatRequestOptions, type CreateMessage, type DataMessage, type DataStreamPart, type DataStreamString, type DeepPartial, type IdGenerator, type JSONValue, type Message, type RequestOptions, type Schema, type ToolInvocation, type UseAssistantOptions, type UseChatOptions, type UseCompletionOptions, asSchema, callChatApi, callCompletionApi, extractMaxToolInvocationStep, formatAssistantStreamPart, formatDataStreamPart, getTextFromDataUrl, isDeepEqualData, jsonSchema, parseAssistantStreamPart, parseDataStreamPart, parsePartialJson, prepareAttachmentsForRequest, processAssistantStream, processDataStream, processTextStream, zodSchema }; |
@@ -1421,7 +1421,8 @@ "use strict"; | ||
var import_zod_to_json_schema = __toESM(require("zod-to-json-schema")); | ||
function zodSchema(zodSchema2) { | ||
function zodSchema(zodSchema2, options) { | ||
var _a; | ||
const useReferences = (_a = options == null ? void 0 : options.useReferences) != null ? _a : false; | ||
return jsonSchema( | ||
(0, import_zod_to_json_schema.default)(zodSchema2, { | ||
$refStrategy: "none", | ||
// no references (to support openapi conversion for google) | ||
$refStrategy: useReferences ? "root" : "none", | ||
target: "jsonSchema7" | ||
@@ -1428,0 +1429,0 @@ // note: openai mode breaks various gemini conversions |
{ | ||
"name": "@ai-sdk/ui-utils", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
349404
3837
84
3
84