@arizeai/phoenix-client
Version:
A client for the Phoenix API
362 lines • 14.8 kB
TypeScript
import z from "zod";
/**
* Union of all message formats
*/
export declare const llmProviderMessageSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
role: z.ZodLiteral<"assistant">;
content: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>>, z.ZodString]>;
name: z.ZodOptional<z.ZodString>;
tool_call_id: z.ZodOptional<z.ZodString>;
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
type: z.ZodPipe<z.ZodOptional<z.ZodLiteral<"function">>, z.ZodTransform<"function", "function" | undefined>>;
id: z.ZodString;
function: z.ZodObject<{
name: z.ZodString;
arguments: z.ZodString;
}, z.core.$loose>;
}, z.core.$strip>>>;
}, z.core.$loose>, z.ZodObject<{
role: z.ZodLiteral<"tool">;
content: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>>, z.ZodString]>;
tool_call_id: z.ZodString;
}, z.core.$loose>, z.ZodObject<{
role: z.ZodLiteral<"function">;
content: z.ZodNullable<z.ZodString>;
name: z.ZodString;
}, z.core.$loose>, z.ZodObject<{
role: z.ZodLiteral<"user">;
content: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"image_url">;
image_url: z.ZodObject<{
url: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>]>>, z.ZodString]>;
name: z.ZodOptional<z.ZodString>;
}, z.core.$loose>, z.ZodObject<{
role: z.ZodLiteral<"system">;
content: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>>, z.ZodString]>;
name: z.ZodOptional<z.ZodString>;
}, z.core.$loose>, z.ZodObject<{
role: z.ZodLiteral<"developer">;
content: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>>, z.ZodString]>;
name: z.ZodOptional<z.ZodString>;
}, z.core.$loose>], "role">, z.ZodObject<{
role: z.ZodEnum<{
user: "user";
assistant: "assistant";
}>;
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"image">;
source: z.ZodObject<{
data: z.ZodString;
media_type: z.ZodEnum<{
"image/jpeg": "image/jpeg";
"image/png": "image/png";
"image/gif": "image/gif";
"image/webp": "image/webp";
}>;
type: z.ZodLiteral<"base64">;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
id: z.ZodString;
type: z.ZodLiteral<"tool_use">;
name: z.ZodString;
input: z.ZodType<import("../jsonLiteralSchema.js").JSONLiteral, unknown, z.core.$ZodTypeInternals<import("../jsonLiteralSchema.js").JSONLiteral, unknown>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"tool_result">;
tool_use_id: z.ZodString;
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"image">;
source: z.ZodObject<{
data: z.ZodString;
media_type: z.ZodEnum<{
"image/jpeg": "image/jpeg";
"image/png": "image/png";
"image/gif": "image/gif";
"image/webp": "image/webp";
}>;
type: z.ZodLiteral<"base64">;
}, z.core.$strip>;
}, z.core.$strip>]>>]>;
is_error: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>], "type">>]>;
}, z.core.$loose>, z.ZodObject<{
role: z.ZodEnum<{
user: "user";
assistant: "assistant";
model: "model";
ai: "ai";
tool: "tool";
system: "system";
developer: "developer";
}>;
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"tool_call">;
tool_call_id: z.ZodString;
tool_call: z.ZodObject<{
type: z.ZodLiteral<"function">;
name: z.ZodString;
arguments: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"tool_result">;
tool_call_id: z.ZodString;
tool_result: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>;
}, z.core.$strip>], "type">>]>;
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
role: z.ZodLiteral<"system">;
content: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
role: z.ZodLiteral<"user">;
content: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"image">;
image: z.ZodString;
mimeType: z.ZodOptional<z.ZodString>;
}, z.core.$strip>]>>, z.ZodString]>;
}, z.core.$strip>, z.ZodObject<{
role: z.ZodLiteral<"assistant">;
content: z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"tool-call">;
toolCallId: z.ZodString;
toolName: z.ZodString;
input: z.ZodType<import("../jsonLiteralSchema.js").JSONLiteral, unknown, z.core.$ZodTypeInternals<import("../jsonLiteralSchema.js").JSONLiteral, unknown>>;
}, z.core.$strip>]>>, z.ZodString]>;
}, z.core.$strip>, z.ZodObject<{
role: z.ZodLiteral<"tool">;
content: z.ZodArray<z.ZodObject<{
type: z.ZodLiteral<"tool-result">;
toolCallId: z.ZodString;
toolName: z.ZodString;
output: z.ZodObject<{
type: z.ZodLiteral<"text">;
value: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>>;
}, z.core.$strip>], "role">]>;
export type LlmProviderMessage = z.infer<typeof llmProviderMessageSchema>;
/**
* Union of all tool call formats
*
* This is useful for functions that need to accept any tool call format
*/
export declare const llmProviderToolCallSchema: z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodPipe<z.ZodOptional<z.ZodLiteral<"function">>, z.ZodTransform<"function", "function" | undefined>>;
id: z.ZodString;
function: z.ZodObject<{
name: z.ZodString;
arguments: z.ZodString;
}, z.core.$loose>;
}, z.core.$strip>, z.ZodObject<{
id: z.ZodString;
type: z.ZodLiteral<"tool_use">;
name: z.ZodString;
input: z.ZodType<import("../jsonLiteralSchema.js").JSONLiteral, unknown, z.core.$ZodTypeInternals<import("../jsonLiteralSchema.js").JSONLiteral, unknown>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"tool_call">;
tool_call_id: z.ZodString;
tool_call: z.ZodObject<{
type: z.ZodLiteral<"function">;
name: z.ZodString;
arguments: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"tool-call">;
toolCallId: z.ZodString;
toolName: z.ZodString;
input: z.ZodType<import("../jsonLiteralSchema.js").JSONLiteral, unknown, z.core.$ZodTypeInternals<import("../jsonLiteralSchema.js").JSONLiteral, unknown>>;
}, z.core.$strip>]>;
export type LlmProviderToolCall = z.infer<typeof llmProviderToolCallSchema>;
/**
* A union of all the lists of tool call formats
*
* This is useful for parsing all of the tool calls in a message
*/
export declare const llmProviderToolCallsSchema: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodPipe<z.ZodOptional<z.ZodLiteral<"function">>, z.ZodTransform<"function", "function" | undefined>>;
id: z.ZodString;
function: z.ZodObject<{
name: z.ZodString;
arguments: z.ZodString;
}, z.core.$loose>;
}, z.core.$strip>, z.ZodObject<{
id: z.ZodString;
type: z.ZodLiteral<"tool_use">;
name: z.ZodString;
input: z.ZodType<import("../jsonLiteralSchema.js").JSONLiteral, unknown, z.core.$ZodTypeInternals<import("../jsonLiteralSchema.js").JSONLiteral, unknown>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"tool_call">;
tool_call_id: z.ZodString;
tool_call: z.ZodObject<{
type: z.ZodLiteral<"function">;
name: z.ZodString;
arguments: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"tool-call">;
toolCallId: z.ZodString;
toolName: z.ZodString;
input: z.ZodType<import("../jsonLiteralSchema.js").JSONLiteral, unknown, z.core.$ZodTypeInternals<import("../jsonLiteralSchema.js").JSONLiteral, unknown>>;
}, z.core.$strip>]>>;
export type LlmProviderToolCalls = z.infer<typeof llmProviderToolCallsSchema>;
/**
* 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
*/
export declare const toolCallHeuristicSchema: z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
name: z.ZodOptional<z.ZodString>;
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
function: z.ZodOptional<z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
arguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare const llmProviderToolChoiceSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"none">, z.ZodLiteral<"required">, z.ZodObject<{
type: z.ZodLiteral<"function">;
function: z.ZodObject<{
name: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>]>, z.ZodDiscriminatedUnion<[z.ZodObject<{
type: z.ZodLiteral<"tool">;
name: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"auto">;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"any">;
}, z.core.$strip>], "type">, z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"none">;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"zero_or_more">;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"one_or_more">;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"specific_function">;
function_name: z.ZodString;
}, z.core.$strip>]>, z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"none">, z.ZodLiteral<"required">, z.ZodObject<{
type: z.ZodLiteral<"tool">;
toolName: z.ZodString;
}, z.core.$strip>]>]>;
export type LlmProviderToolChoice = z.infer<typeof llmProviderToolChoiceSchema>;
/**
* Union of all tool call formats
*
* This is useful for functions that need to accept any tool definition format
*/
export declare const llmProviderToolDefinitionSchema: z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"function">;
function: z.ZodObject<{
name: z.ZodString;
description: z.ZodOptional<z.ZodString>;
parameters: z.ZodObject<{
type: z.ZodLiteral<"object">;
properties: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodEnum<{
string: "string";
number: "number";
boolean: "boolean";
object: "object";
null: "null";
array: "array";
integer: "integer";
}>;
description: z.ZodOptional<z.ZodString>;
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$loose>, z.ZodObject<{
anyOf: z.ZodArray<z.ZodObject<{
type: z.ZodEnum<{
string: "string";
number: "number";
boolean: "boolean";
object: "object";
null: "null";
array: "array";
integer: "integer";
}>;
description: z.ZodOptional<z.ZodString>;
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$loose>>;
}, z.core.$strip>]>>;
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
additionalProperties: z.ZodOptional<z.ZodBoolean>;
strict: z.ZodOptional<z.ZodBoolean>;
}, z.core.$loose>;
}, z.core.$loose>;
}, z.core.$loose>, z.ZodObject<{
name: z.ZodString;
description: z.ZodString;
input_schema: z.ZodObject<{
type: z.ZodLiteral<"object">;
properties: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodEnum<{
string: "string";
number: "number";
boolean: "boolean";
object: "object";
null: "null";
array: "array";
integer: "integer";
}>;
description: z.ZodOptional<z.ZodString>;
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$loose>, z.ZodObject<{
anyOf: z.ZodArray<z.ZodObject<{
type: z.ZodEnum<{
string: "string";
number: "number";
boolean: "boolean";
object: "object";
null: "null";
array: "array";
integer: "integer";
}>;
description: z.ZodOptional<z.ZodString>;
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$loose>>;
}, z.core.$strip>]>>;
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
additionalProperties: z.ZodOptional<z.ZodBoolean>;
}, z.core.$loose>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"function">;
function: z.ZodObject<{
name: z.ZodString;
description: z.ZodOptional<z.ZodString>;
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
strict: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
}, z.core.$strip>]>;
export type LlmProviderToolDefinition = z.infer<typeof llmProviderToolDefinitionSchema>;
//# sourceMappingURL=schemas.d.ts.map