@arizeai/phoenix-client
Version:
A client for the Phoenix API
47 lines • 1.73 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.openAIToolCallsSchema = exports.openAIToolCallSchema = void 0;
exports.createOpenAIToolCall = createOpenAIToolCall;
const zod_1 = __importDefault(require("zod"));
/**
* The schema for an OpenAI tool call, this is what a message that calls a tool looks like
*
* Note: The nested passThrough's are used to allow for extra keys in JSON schema, however, they do not actually
* allow for extra keys when the zod schema is used for parsing. This is to allow more flexibility for users
* to define their own tool calls according
*/
exports.openAIToolCallSchema = zod_1.default.object({
type: zod_1.default
.literal("function")
.optional()
.transform(() => "function"),
id: zod_1.default.string().describe("The ID of the tool call"),
function: zod_1.default
.object({
name: zod_1.default.string().describe("The name of the function"),
arguments: zod_1.default.string().describe("The arguments for the function"),
})
.describe("The function that is being called")
.passthrough(),
});
/**
* The zod schema for multiple OpenAI Tool Calls
*/
exports.openAIToolCallsSchema = zod_1.default.array(exports.openAIToolCallSchema);
/**
* Creates an empty OpenAI tool call with fields but no values filled in
*/
function createOpenAIToolCall() {
return {
type: "function",
id: "",
function: {
name: "",
arguments: "{}",
},
};
}
//# sourceMappingURL=toolCallSchemas.js.map