UNPKG

@arizeai/phoenix-client

Version:

A client for the Phoenix API

83 lines 3.69 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.llmProviderToolDefinitionSchema = exports.llmProviderToolChoiceSchema = exports.toolCallHeuristicSchema = exports.llmProviderToolCallsSchema = exports.llmProviderToolCallSchema = exports.llmProviderMessageSchema = void 0; const messageSchemas_1 = require("./anthropic/messageSchemas"); const toolCallSchemas_1 = require("./anthropic/toolCallSchemas"); const toolChoiceSchemas_1 = require("./anthropic/toolChoiceSchemas"); const toolSchemas_1 = require("./anthropic/toolSchemas"); const messageSchemas_2 = require("./openai/messageSchemas"); const toolCallSchemas_2 = require("./openai/toolCallSchemas"); const toolChoiceSchemas_2 = require("./openai/toolChoiceSchemas"); const toolSchemas_2 = require("./openai/toolSchemas"); const messageSchemas_3 = require("./phoenixPrompt/messageSchemas"); const toolCallSchemas_3 = require("./phoenixPrompt/toolCallSchemas"); const toolChoiceSchemas_3 = require("./phoenixPrompt/toolChoiceSchemas"); const toolSchemas_3 = require("./phoenixPrompt/toolSchemas"); const messagePartSchemas_1 = require("./vercel/messagePartSchemas"); const messageSchemas_4 = require("./vercel/messageSchemas"); const toolChoiceSchemas_4 = require("./vercel/toolChoiceSchemas"); const zod_1 = __importDefault(require("zod")); /** * Union of all message formats */ exports.llmProviderMessageSchema = zod_1.default.union([ messageSchemas_2.openAIMessageSchema, messageSchemas_1.anthropicMessageSchema, messageSchemas_3.phoenixMessageSchema, messageSchemas_4.vercelAIMessageSchema, ]); /** * Union of all tool call formats * * This is useful for functions that need to accept any tool call format */ exports.llmProviderToolCallSchema = zod_1.default.union([ toolCallSchemas_2.openAIToolCallSchema, toolCallSchemas_1.anthropicToolCallSchema, toolCallSchemas_3.phoenixToolCallSchema, messagePartSchemas_1.vercelAIChatPartToolCallSchema, ]); /** * A union of all the lists of tool call formats * * This is useful for parsing all of the tool calls in a message */ exports.llmProviderToolCallsSchema = zod_1.default.array(exports.llmProviderToolCallSchema); /** * A schema for a tool call that is not in the first class supported format * * This is used to heuristically find the id, name, and arguments of a tool call * based on common patterns in tool calls, allowing us to poke around in an unknown tool call * and extract the id, name, and arguments */ exports.toolCallHeuristicSchema = zod_1.default.object({ id: zod_1.default.string().optional(), name: zod_1.default.string().optional(), arguments: zod_1.default.record(zod_1.default.unknown()).optional(), function: zod_1.default .object({ name: zod_1.default.string().optional(), arguments: zod_1.default.record(zod_1.default.unknown()).optional(), }) .optional(), }); exports.llmProviderToolChoiceSchema = zod_1.default.union([ toolChoiceSchemas_2.openAIToolChoiceSchema, toolChoiceSchemas_1.anthropicToolChoiceSchema, toolChoiceSchemas_3.phoenixToolChoiceSchema, toolChoiceSchemas_4.vercelAIToolChoiceSchema, ]); /** * Union of all tool call formats * * This is useful for functions that need to accept any tool definition format */ exports.llmProviderToolDefinitionSchema = zod_1.default.union([ toolSchemas_2.openAIToolDefinitionSchema, toolSchemas_1.anthropicToolDefinitionSchema, toolSchemas_3.phoenixToolDefinitionSchema, ]); //# sourceMappingURL=schemas.js.map