@arizeai/phoenix-client
Version:
A client for the Phoenix API
44 lines • 1.91 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.vercelAIChatPartSchema = exports.vercelAIChatPartToolResultSchema = exports.vercelAIChatPartToolCallSchema = exports.vercelAIChatPartImageSchema = exports.vercelAIChatPartTextSchema = void 0;
const jsonLiteralSchema_1 = require("../../jsonLiteralSchema");
const zod_1 = __importDefault(require("zod"));
/*
*
* Vercel AI SDK Message Part Schemas
*
*/
exports.vercelAIChatPartTextSchema = zod_1.default.object({
type: zod_1.default.literal("text"),
text: zod_1.default.string(),
});
exports.vercelAIChatPartImageSchema = zod_1.default.object({
type: zod_1.default.literal("image"),
image: zod_1.default.string(), // ai supports more, but we will just support base64 for now
mimeType: zod_1.default.string().optional(),
});
exports.vercelAIChatPartToolCallSchema = zod_1.default.object({
type: zod_1.default.literal("tool-call"),
toolCallId: zod_1.default.string(),
toolName: zod_1.default.string(),
input: jsonLiteralSchema_1.jsonLiteralSchema, // json serializable parameters
});
exports.vercelAIChatPartToolResultSchema = zod_1.default.object({
type: zod_1.default.literal("tool-result"),
toolCallId: zod_1.default.string(),
toolName: zod_1.default.string(),
output: zod_1.default.object({
type: zod_1.default.literal("text"), // TODO: extend to support other output types
value: zod_1.default.string(),
}),
});
exports.vercelAIChatPartSchema = zod_1.default.discriminatedUnion("type", [
exports.vercelAIChatPartTextSchema,
exports.vercelAIChatPartImageSchema,
exports.vercelAIChatPartToolCallSchema,
exports.vercelAIChatPartToolResultSchema,
]);
//# sourceMappingURL=messagePartSchemas.js.map