UNPKG

@assistant-ui/react

Version:

React components for AI chat.

97 lines (96 loc) 3.74 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/runtimes/edge/EdgeRuntimeRequestOptions.ts var EdgeRuntimeRequestOptions_exports = {}; __export(EdgeRuntimeRequestOptions_exports, { EdgeRuntimeRequestOptionsSchema: () => EdgeRuntimeRequestOptionsSchema }); module.exports = __toCommonJS(EdgeRuntimeRequestOptions_exports); var import_ModelConfigTypes = require("../../types/ModelConfigTypes.cjs"); var import_zod = require("zod"); var LanguageModelV1FunctionToolSchema = import_zod.z.object({ type: import_zod.z.literal("function"), name: import_zod.z.string(), description: import_zod.z.string().optional(), parameters: import_zod.z.custom( (val) => typeof val === "object" && val !== null ) }); var TextContentPartSchema = import_zod.z.object({ type: import_zod.z.literal("text"), text: import_zod.z.string() }); var ImageContentPartSchema = import_zod.z.object({ type: import_zod.z.literal("image"), image: import_zod.z.string() }); var Unstable_AudioContentPart = import_zod.z.object({ type: import_zod.z.literal("audio"), audio: import_zod.z.object({ data: import_zod.z.string(), format: import_zod.z.union([import_zod.z.literal("mp3"), import_zod.z.literal("wav")]) }) }); var CoreToolCallContentPartSchema = import_zod.z.object({ type: import_zod.z.literal("tool-call"), toolCallId: import_zod.z.string(), toolName: import_zod.z.string(), args: import_zod.z.record(import_zod.z.unknown()), result: import_zod.z.unknown().optional(), isError: import_zod.z.boolean().optional() }); var CoreUserMessageSchema = import_zod.z.object({ role: import_zod.z.literal("user"), content: import_zod.z.array( import_zod.z.discriminatedUnion("type", [ TextContentPartSchema, ImageContentPartSchema, Unstable_AudioContentPart ]) ).min(1) }); var CoreAssistantMessageSchema = import_zod.z.object({ role: import_zod.z.literal("assistant"), content: import_zod.z.array( import_zod.z.discriminatedUnion("type", [ TextContentPartSchema, CoreToolCallContentPartSchema ]) ).min(1) }); var CoreSystemMessageSchema = import_zod.z.object({ role: import_zod.z.literal("system"), content: import_zod.z.tuple([TextContentPartSchema]) }); var CoreMessageSchema = import_zod.z.discriminatedUnion("role", [ CoreSystemMessageSchema, CoreUserMessageSchema, CoreAssistantMessageSchema ]); var EdgeRuntimeRequestOptionsSchema = import_zod.z.object({ system: import_zod.z.string().optional(), messages: import_zod.z.array(CoreMessageSchema).min(1), tools: import_zod.z.array(LanguageModelV1FunctionToolSchema).optional(), unstable_assistantMessageId: import_zod.z.string().optional() }).merge(import_ModelConfigTypes.LanguageModelV1CallSettingsSchema).merge(import_ModelConfigTypes.LanguageModelConfigSchema); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { EdgeRuntimeRequestOptionsSchema }); //# sourceMappingURL=EdgeRuntimeRequestOptions.js.map