@genkit-ai/ai
Version:
Genkit AI framework generative AI APIs.
1,385 lines (1,383 loc) • 101 kB
TypeScript
import { ToolResponse, Part } from './parts.js';
import { z, Action } from '@genkit-ai/core';
import { Registry } from '@genkit-ai/core/registry';
import { D as Document, a as DocumentData } from './document-CoNzqSW7.js';
/** Implementation function for a reranker. Receives a query, documents, and options. */
type RerankerFn<RerankerOptions extends z.ZodTypeAny> = (query: Document, documents: Document[], queryOpts: z.infer<RerankerOptions>) => Promise<RerankerResponse>;
/**
* Zod schema for a reranked document metadata.
*/
declare const RankedDocumentMetadataSchema: z.ZodObject<{
score: z.ZodNumber;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
score: z.ZodNumber;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
score: z.ZodNumber;
}, z.ZodTypeAny, "passthrough">>;
declare const RankedDocumentDataSchema: z.ZodObject<{
content: z.ZodArray<z.ZodUnion<[z.ZodObject<{
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
media: z.ZodObject<{
contentType: z.ZodOptional<z.ZodString>;
url: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
contentType?: string | undefined;
}, {
url: string;
contentType?: string | undefined;
}>;
}, "strip", z.ZodTypeAny, {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
toolRequest: z.ZodObject<{
ref: z.ZodOptional<z.ZodString>;
name: z.ZodString;
input: z.ZodOptional<z.ZodUnknown>;
partial: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
}, {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
}>;
}, "strip", z.ZodTypeAny, {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
toolResponse: z.ZodType<ToolResponse, z.ZodTypeDef, ToolResponse>;
}, "strip", z.ZodTypeAny, {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
data: z.ZodUnknown;
}, "strip", z.ZodTypeAny, {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
custom: z.ZodRecord<z.ZodString, z.ZodAny>;
}, "strip", z.ZodTypeAny, {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
resource: z.ZodOptional<z.ZodNever>;
} & {
reasoning: z.ZodString;
}, "strip", z.ZodTypeAny, {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
}, {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
} & {
resource: z.ZodObject<{
uri: z.ZodString;
}, "strip", z.ZodTypeAny, {
uri: string;
}, {
uri: string;
}>;
}, "strip", z.ZodTypeAny, {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
}, {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
}>]>, "many">;
metadata: z.ZodObject<{
score: z.ZodNumber;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
score: z.ZodNumber;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
score: z.ZodNumber;
}, z.ZodTypeAny, "passthrough">>;
}, "strip", z.ZodTypeAny, {
metadata: {
score: number;
} & {
[k: string]: unknown;
};
content: ({
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
} | {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
})[];
}, {
metadata: {
score: number;
} & {
[k: string]: unknown;
};
content: ({
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
} | {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
})[];
}>;
type RankedDocumentData = z.infer<typeof RankedDocumentDataSchema>;
declare class RankedDocument extends Document implements RankedDocumentData {
content: Part[];
metadata: {
score: number;
} & Record<string, any>;
constructor(data: RankedDocumentData);
/**
* Returns the score of the document.
* @returns The score of the document.
*/
score(): number;
}
declare const RerankerRequestSchema: z.ZodObject<{
query: z.ZodObject<{
content: z.ZodArray<z.ZodUnion<[z.ZodObject<{
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
media: z.ZodObject<{
contentType: z.ZodOptional<z.ZodString>;
url: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
contentType?: string | undefined;
}, {
url: string;
contentType?: string | undefined;
}>;
}, "strip", z.ZodTypeAny, {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
toolRequest: z.ZodObject<{
ref: z.ZodOptional<z.ZodString>;
name: z.ZodString;
input: z.ZodOptional<z.ZodUnknown>;
partial: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
}, {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
}>;
}, "strip", z.ZodTypeAny, {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
toolResponse: z.ZodType<ToolResponse, z.ZodTypeDef, ToolResponse>;
}, "strip", z.ZodTypeAny, {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
data: z.ZodUnknown;
}, "strip", z.ZodTypeAny, {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
custom: z.ZodRecord<z.ZodString, z.ZodAny>;
}, "strip", z.ZodTypeAny, {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
resource: z.ZodOptional<z.ZodNever>;
} & {
reasoning: z.ZodString;
}, "strip", z.ZodTypeAny, {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
}, {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
} & {
resource: z.ZodObject<{
uri: z.ZodString;
}, "strip", z.ZodTypeAny, {
uri: string;
}, {
uri: string;
}>;
}, "strip", z.ZodTypeAny, {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
}, {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
}>]>, "many">;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
}, "strip", z.ZodTypeAny, {
content: ({
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
} | {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
})[];
metadata?: Record<string, any> | undefined;
}, {
content: ({
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
} | {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
} | {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
})[];
metadata?: Record<string, any> | undefined;
}>;
documents: z.ZodArray<z.ZodObject<{
content: z.ZodArray<z.ZodUnion<[z.ZodObject<{
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
text: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
media: z.ZodObject<{
contentType: z.ZodOptional<z.ZodString>;
url: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
contentType?: string | undefined;
}, {
url: string;
contentType?: string | undefined;
}>;
}, "strip", z.ZodTypeAny, {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
media: {
url: string;
contentType?: string | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
toolRequest: z.ZodObject<{
ref: z.ZodOptional<z.ZodString>;
name: z.ZodString;
input: z.ZodOptional<z.ZodUnknown>;
partial: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
}, {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
}>;
}, "strip", z.ZodTypeAny, {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
toolRequest: {
name: string;
ref?: string | undefined;
input?: unknown;
partial?: boolean | undefined;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
toolResponse: z.ZodType<ToolResponse, z.ZodTypeDef, ToolResponse>;
}, "strip", z.ZodTypeAny, {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
toolResponse: {
name: string;
output?: unknown;
ref?: string | undefined;
} & {
content?: Part[];
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
data: z.ZodUnknown;
}, "strip", z.ZodTypeAny, {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
resource: z.ZodOptional<z.ZodNever>;
} & {
custom: z.ZodRecord<z.ZodString, z.ZodAny>;
}, "strip", z.ZodTypeAny, {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}, {
custom: Record<string, any>;
metadata?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
resource: z.ZodOptional<z.ZodNever>;
} & {
reasoning: z.ZodString;
}, "strip", z.ZodTypeAny, {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
}, {
reasoning: string;
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
resource?: undefined;
}>, z.ZodObject<{
text: z.ZodOptional<z.ZodNever>;
media: z.ZodOptional<z.ZodNever>;
toolRequest: z.ZodOptional<z.ZodNever>;
toolResponse: z.ZodOptional<z.ZodNever>;
data: z.ZodOptional<z.ZodUnknown>;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
reasoning: z.ZodOptional<z.ZodNever>;
} & {
resource: z.ZodObject<{
uri: z.ZodString;
}, "strip", z.ZodTypeAny, {
uri: string;
}, {
uri: string;
}>;
}, "strip", z.ZodTypeAny, {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
}, {
resource: {
uri: string;
};
metadata?: Record<string, unknown> | undefined;
custom?: Record<string, unknown> | undefined;
text?: undefined;
media?: undefined;
toolRequest?: undefined;
toolResponse?: undefined;
data?: unknown;
reasoning?: undefined;
}>]>, "many">;
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
}, "strip", z.ZodTypeAny, {
content: ({