toOpenAIMessage( message: unknown,): | null | objectOutputType< { content: ZodUnion< [ ZodArray< ZodObject< { text: ZodString; type: ZodLiteral<"text"> }, "strip", ZodTypeAny, { text: string; type: "text" }, { text: string; type: "text" }, >, "many", >, ZodString, ], >; name: ZodOptional<ZodString>; role: ZodLiteral<"assistant">; tool_call_id: ZodOptional<ZodString>; tool_calls: ZodOptional< ZodArray< ZodObject< { function: ZodObject< { arguments: ZodString; name: ZodString }, "passthrough", ZodTypeAny, objectOutputType< { arguments: ZodString; name: ZodString }, ZodTypeAny, "passthrough", >, objectInputType< { arguments: ZodString; name: ZodString }, ZodTypeAny, "passthrough", >, >; id: ZodString; type: ZodEffects< ZodOptional<ZodLiteral<"function">>, "function", undefined | "function", >; }, "strip", ZodTypeAny, { function: { arguments: string; name: string } & { [k: string]: unknown; }; id: string; type: "function"; }, { function: { arguments: string; name: string } & { [k: string]: unknown; }; id: string; type?: "function"; }, >, "many", >, >; }, ZodTypeAny, "passthrough", > | objectOutputType< { content: ZodUnion< [ ZodArray< ZodObject< { text: ZodString; type: ZodLiteral<"text"> }, "strip", ZodTypeAny, { text: string; type: "text" }, { text: string; type: "text" }, >, "many", >, ZodString, ], >; role: ZodLiteral<"tool">; tool_call_id: ZodString; }, ZodTypeAny, "passthrough", > | objectOutputType< { content: ZodNullable<ZodString>; name: ZodString; role: ZodLiteral<"function">; }, ZodTypeAny, "passthrough", > | objectOutputType< { content: ZodUnion< [ ZodArray< ZodUnion< [ ZodObject< { text: ZodString; type: ZodLiteral<(...)
> }, "strip", ZodTypeAny, { text: string; type: "text" }, { text: string; type: "text" }, >, ZodObject< { image_url: ZodObject<(...)
, (...)
, (...)
, (...)
, (...)
>; type: ZodLiteral<(...)
>; }, "strip", ZodTypeAny, { image_url: { url: ...
}; type: "image_url" }, { image_url: { url: ...
}; type: "image_url" }, >, ], >, "many", >, ZodString, ], >; name: ZodOptional<ZodString>; role: ZodLiteral<"user">; }, ZodTypeAny, "passthrough", > | objectOutputType< { content: ZodUnion< [ ZodArray< ZodObject< { text: ZodString; type: ZodLiteral<"text"> }, "strip", ZodTypeAny, { text: string; type: "text" }, { text: string; type: "text" }, >, "many", >, ZodString, ], >; name: ZodOptional<ZodString>; role: ZodLiteral<"system">; }, ZodTypeAny, "passthrough", > | objectOutputType< { content: ZodUnion< [ ZodArray< ZodObject< { text: ZodString; type: ZodLiteral<"text"> }, "strip", ZodTypeAny, { text: string; type: "text" }, { text: string; type: "text" }, >, "many", >, ZodString, ], >; name: ZodOptional<ZodString>; role: ZodLiteral<"developer">; }, ZodTypeAny, "passthrough", > Returns
| null
| objectOutputType<
{
content: ZodUnion<
[
ZodArray<
ZodObject<
{ text: ZodString; type: ZodLiteral<"text"> },
"strip",
ZodTypeAny,
{ text: string; type: "text" },
{ text: string; type: "text" },
>,
"many",
>,
ZodString,
],
>;
name: ZodOptional<ZodString>;
role: ZodLiteral<"assistant">;
tool_call_id: ZodOptional<ZodString>;
tool_calls: ZodOptional<
ZodArray<
ZodObject<
{
function: ZodObject<
{ arguments: ZodString; name: ZodString },
"passthrough",
ZodTypeAny,
objectOutputType<
{ arguments: ZodString; name: ZodString },
ZodTypeAny,
"passthrough",
>,
objectInputType<
{ arguments: ZodString; name: ZodString },
ZodTypeAny,
"passthrough",
>,
>;
id: ZodString;
type: ZodEffects<
ZodOptional<ZodLiteral<"function">>,
"function",
undefined | "function",
>;
},
"strip",
ZodTypeAny,
{
function: { arguments: string; name: string } & {
[k: string]: unknown;
};
id: string;
type: "function";
},
{
function: { arguments: string; name: string } & {
[k: string]: unknown;
};
id: string;
type?: "function";
},
>,
"many",
>,
>;
},
ZodTypeAny,
"passthrough",
>
| objectOutputType<
{
content: ZodUnion<
[
ZodArray<
ZodObject<
{ text: ZodString; type: ZodLiteral<"text"> },
"strip",
ZodTypeAny,
{ text: string; type: "text" },
{ text: string; type: "text" },
>,
"many",
>,
ZodString,
],
>;
role: ZodLiteral<"tool">;
tool_call_id: ZodString;
},
ZodTypeAny,
"passthrough",
>
| objectOutputType<
{
content: ZodNullable<ZodString>;
name: ZodString;
role: ZodLiteral<"function">;
},
ZodTypeAny,
"passthrough",
>
| objectOutputType<
{
content: ZodUnion<
[
ZodArray<
ZodUnion<
[
ZodObject<
{ text: ZodString; type: ZodLiteral<(...)> },
"strip",
ZodTypeAny,
{ text: string; type: "text" },
{ text: string; type: "text" },
>,
ZodObject<
{
image_url: ZodObject<(...), (...), (...), (...), (...)>;
type: ZodLiteral<(...)>;
},
"strip",
ZodTypeAny,
{ image_url: { url: ... }; type: "image_url" },
{ image_url: { url: ... }; type: "image_url" },
>,
],
>,
"many",
>,
ZodString,
],
>;
name: ZodOptional<ZodString>;
role: ZodLiteral<"user">;
},
ZodTypeAny,
"passthrough",
>
| objectOutputType<
{
content: ZodUnion<
[
ZodArray<
ZodObject<
{ text: ZodString; type: ZodLiteral<"text"> },
"strip",
ZodTypeAny,
{ text: string; type: "text" },
{ text: string; type: "text" },
>,
"many",
>,
ZodString,
],
>;
name: ZodOptional<ZodString>;
role: ZodLiteral<"system">;
},
ZodTypeAny,
"passthrough",
>
| objectOutputType<
{
content: ZodUnion<
[
ZodArray<
ZodObject<
{ text: ZodString; type: ZodLiteral<"text"> },
"strip",
ZodTypeAny,
{ text: string; type: "text" },
{ text: string; type: "text" },
>,
"many",
>,
ZodString,
],
>;
name: ZodOptional<ZodString>;
role: ZodLiteral<"developer">;
},
ZodTypeAny,
"passthrough",
>
Convert from any message format to OpenAI format if possible