Parameters
- params: {
targetProvider: TargetProviderSDK;
toolCall: {
function: { arguments: string; name: string; [key: string]: unknown };
id: string;
type: "function";
};
}toolCall: {
function: { arguments: string; name: string; [key: string]: unknown };
id: string;
type: "function";
}
Returns output<
{
ANTHROPIC: SDKConverters<
ZodPipe<
ZodDiscriminatedUnion<
[
ZodObject<
{
content: ...;
name: ...;
role: ...;
tool_call_id: ...;
tool_calls: ...;
},
$loose,
>,
ZodObject<{ content: ...; role: ...; tool_call_id: ... }, $loose>,
ZodObject<{ content: ...; name: ...; role: ... }, $loose>,
],
"role",
>,
ZodTransform<
{
content: string
| (...)[];
role: "user" | "assistant";
[key: string]: unknown;
},
| {
content: (...)
| (...);
name?: (...) | (...);
role: "assistant";
tool_call_id?: (...) | (...);
tool_calls?: (...) | (...);
[key: string]: unknown;
}
| {
content: (...)
| (...);
role: "tool";
tool_call_id: string;
[key: string]: unknown;
}
| {
content: (...)
| (...);
name: string;
role: "function";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "user";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "system";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "developer";
[key: string]: unknown;
},
>,
>,
ZodPipe<
ZodDiscriminatedUnion<
[
ZodObject<{ text: ...; type: ... }, $strip>,
ZodObject<{ image_url: ...; type: ... }, $strip>,
],
"type",
>,
ZodTransform<
| { source?: undefined; text: string; type: "text" }
| {
source: { data: ...; media_type: ...; type: ... };
text?: undefined;
type: "image";
}
| null,
| { text: string; type: "text" }
| { image_url: { url: ... }; type: "image_url" },
>,
>,
ZodPipe<
ZodUnion<
readonly [
ZodLiteral<"auto">,
ZodLiteral<"none">,
ZodLiteral<"required">,
ZodObject<{ function: ...; type: ... }, $strip>,
],
>,
ZodTransform<
{ name: string; type: "tool" }
| { type: "auto" }
| { type: "any" },
| "none"
| "auto"
| "required"
| { function: { name: ... }; type: "function" },
>,
>,
ZodPipe<
ZodObject<
{
function: ZodObject<{ arguments: ...; name: ... }, $loose>;
id: ZodString;
type: ZodPipe<ZodOptional<(...)>, ZodTransform<(...), (...)>>;
},
$strip,
>,
ZodTransform<
{ id: string; input: JSONLiteral; name: string; type: "tool_use" },
{
function: {
arguments: string;
name: string;
[key: string]: unknown;
};
id: string;
type: "function";
},
>,
>,
ZodPipe<
ZodObject<
{
function: ZodObject<
{ description: ...; name: ...; parameters: ... },
$loose,
>;
type: ZodLiteral<"function">;
},
$loose,
>,
ZodTransform<
{
description: string;
input_schema: {
additionalProperties?: (...)
| (...)
| (...);
properties: Record<(...), (...)>;
required?: (...) | (...);
type: "object";
[key: string]: unknown;
};
name: string;
},
{
function: {
description?: (...)
| (...);
name: string;
parameters: {
additionalProperties?: ...;
properties: ...;
required?: ...;
strict?: ...;
type: ...;
[key: ...]: ...;
};
[key: string]: unknown;
};
type: "function";
[key: string]: unknown;
},
>,
>,
ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>,
>;
AZURE_OPENAI: SDKConverters<
ZodDiscriminatedUnion<
[
ZodObject<
{
content: ZodUnion<(...)>;
name: ZodOptional<(...)>;
role: ZodLiteral<(...)>;
tool_call_id: ZodOptional<(...)>;
tool_calls: ZodOptional<(...)>;
},
$loose,
>,
ZodObject<
{
content: ZodUnion<(...)>;
role: ZodLiteral<(...)>;
tool_call_id: ZodString;
},
$loose,
>,
ZodObject<
{
content: ZodNullable<(...)>;
name: ZodString;
role: ZodLiteral<(...)>;
},
$loose,
>,
],
"role",
>,
ZodDiscriminatedUnion<
[
ZodObject<{ text: ZodString; type: ZodLiteral<(...)> }, $strip>,
ZodObject<
{ image_url: ZodObject<(...), (...)>; type: ZodLiteral<(...)> },
$strip,
>,
],
"type",
>,
ZodUnion<
readonly [
ZodLiteral<"auto">,
ZodLiteral<"none">,
ZodLiteral<"required">,
ZodObject<
{ function: ZodObject<(...), (...)>; type: ZodLiteral<(...)> },
$strip,
>,
],
>,
ZodObject<
{
function: ZodObject<
{ arguments: ZodString; name: ZodString },
$loose,
>;
id: ZodString;
type: ZodPipe<
ZodOptional<ZodLiteral<(...)>>,
ZodTransform<"function", (...) | (...)>,
>;
},
$strip,
>,
ZodObject<
{
function: ZodObject<
{
description: ZodOptional<(...)>;
name: ZodString;
parameters: ZodObject<(...), (...)>;
},
$loose,
>;
type: ZodLiteral<"function">;
},
$loose,
>,
ZodObject<
{
json_schema: ZodObject<
{
description: ZodOptional<(...)>;
name: ZodString;
schema: ZodObject<(...), (...)>;
},
$strip,
>;
type: ZodLiteral<"json_schema">;
},
$strip,
>,
>;
OPENAI: SDKConverters<
ZodDiscriminatedUnion<
[
ZodObject<
{
content: ZodUnion<(...)>;
name: ZodOptional<(...)>;
role: ZodLiteral<(...)>;
tool_call_id: ZodOptional<(...)>;
tool_calls: ZodOptional<(...)>;
},
$loose,
>,
ZodObject<
{
content: ZodUnion<(...)>;
role: ZodLiteral<(...)>;
tool_call_id: ZodString;
},
$loose,
>,
ZodObject<
{
content: ZodNullable<(...)>;
name: ZodString;
role: ZodLiteral<(...)>;
},
$loose,
>,
],
"role",
>,
ZodDiscriminatedUnion<
[
ZodObject<{ text: ZodString; type: ZodLiteral<(...)> }, $strip>,
ZodObject<
{ image_url: ZodObject<(...), (...)>; type: ZodLiteral<(...)> },
$strip,
>,
],
"type",
>,
ZodUnion<
readonly [
ZodLiteral<"auto">,
ZodLiteral<"none">,
ZodLiteral<"required">,
ZodObject<
{ function: ZodObject<(...), (...)>; type: ZodLiteral<(...)> },
$strip,
>,
],
>,
ZodObject<
{
function: ZodObject<
{ arguments: ZodString; name: ZodString },
$loose,
>;
id: ZodString;
type: ZodPipe<
ZodOptional<ZodLiteral<(...)>>,
ZodTransform<"function", (...) | (...)>,
>;
},
$strip,
>,
ZodObject<
{
function: ZodObject<
{
description: ZodOptional<(...)>;
name: ZodString;
parameters: ZodObject<(...), (...)>;
},
$loose,
>;
type: ZodLiteral<"function">;
},
$loose,
>,
ZodObject<
{
json_schema: ZodObject<
{
description: ZodOptional<(...)>;
name: ZodString;
schema: ZodObject<(...), (...)>;
},
$strip,
>;
type: ZodLiteral<"json_schema">;
},
$strip,
>,
>;
PHOENIX: SDKConverters<
ZodPipe<
ZodDiscriminatedUnion<
[
ZodObject<
{
content: ...;
name: ...;
role: ...;
tool_call_id: ...;
tool_calls: ...;
},
$loose,
>,
ZodObject<{ content: ...; role: ...; tool_call_id: ... }, $loose>,
ZodObject<{ content: ...; name: ...; role: ... }, $loose>,
],
"role",
>,
ZodTransform<
{
content: string
| (...)[];
role:
| "user"
| "assistant"
| "model"
| "ai"
| "tool"
| "system"
| "developer";
},
| {
content: (...)
| (...);
name?: (...) | (...);
role: "assistant";
tool_call_id?: (...) | (...);
tool_calls?: (...) | (...);
[key: string]: unknown;
}
| {
content: (...)
| (...);
role: "tool";
tool_call_id: string;
[key: string]: unknown;
}
| {
content: (...)
| (...);
name: string;
role: "function";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "user";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "system";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "developer";
[key: string]: unknown;
},
>,
>,
ZodUnknown,
ZodUnknown,
ZodUnknown,
ZodUnknown,
ZodUnknown,
>;
VERCEL_AI: SDKConverters<
ZodPipe<
ZodDiscriminatedUnion<
[
ZodObject<
{
content: ...;
name: ...;
role: ...;
tool_call_id: ...;
tool_calls: ...;
},
$loose,
>,
ZodObject<{ content: ...; role: ...; tool_call_id: ... }, $loose>,
ZodObject<{ content: ...; name: ...; role: ... }, $loose>,
],
"role",
>,
ZodTransform<
| { content: string; role: "system" }
| { content: (...) | (...); role: "user" }
| { content: (...) | (...); role: "assistant" }
| { content: (...)[]; role: "tool" },
| {
content: (...)
| (...);
name?: (...) | (...);
role: "assistant";
tool_call_id?: (...) | (...);
tool_calls?: (...) | (...);
[key: string]: unknown;
}
| {
content: (...)
| (...);
role: "tool";
tool_call_id: string;
[key: string]: unknown;
}
| {
content: (...)
| (...);
name: string;
role: "function";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "user";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "system";
[key: string]: unknown;
}
| {
content: (...)
| (...);
name?: (...) | (...);
role: "developer";
[key: string]: unknown;
},
>,
>,
ZodDiscriminatedUnion<
[
ZodObject<{ text: ZodString; type: ZodLiteral<(...)> }, $strip>,
ZodObject<
{
image: ZodString;
mimeType: ZodOptional<(...)>;
type: ZodLiteral<(...)>;
},
$strip,
>,
ZodObject<
{
input: ZodType<(...), (...), (...)>;
toolCallId: ZodString;
toolName: ZodString;
type: ZodLiteral<(...)>;
},
$strip,
>,
ZodObject<
{
output: ZodObject<(...), (...)>;
toolCallId: ZodString;
toolName: ZodString;
type: ZodLiteral<(...)>;
},
$strip,
>,
],
"type",
>,
ZodPipe<
ZodUnion<
readonly [
ZodLiteral<"auto">,
ZodLiteral<"none">,
ZodLiteral<"required">,
ZodObject<{ function: ...; type: ... }, $strip>,
],
>,
ZodTransform<
"none"
| "auto"
| "required"
| { toolName: string; type: "tool" },
| "none"
| "auto"
| "required"
| { function: { name: ... }; type: "function" },
>,
>,
ZodObject<
{
input: ZodType<
JSONLiteral,
unknown,
$ZodTypeInternals<JSONLiteral, unknown>,
>;
toolCallId: ZodString;
toolName: ZodString;
type: ZodLiteral<"tool-call">;
},
$strip,
>,
ZodPipe<
ZodObject<
{
function: ZodObject<
{ description: ...; name: ...; parameters: ... },
$loose,
>;
type: ZodLiteral<"function">;
},
$loose,
>,
ZodTransform<
{
description?: string;
inputSchema: {
_type: unknown;
jsonSchema?: (...)
| (...);
validate: unknown;
};
type: "function";
},
{
function: {
description?: (...)
| (...);
name: string;
parameters: {
additionalProperties?: ...;
properties: ...;
required?: ...;
strict?: ...;
type: ...;
[key: ...]: ...;
};
[key: string]: unknown;
};
type: "function";
[key: string]: unknown;
},
>,
>,
ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>,
>;
}[TargetProviderSDK]["toolCalls"]["fromOpenAI"],
>
the tool call in the target provider format
Converts a tool call to a target provider format