fix: types for step handler

This commit is contained in:
Danny Avila 2024-09-03 07:00:18 -04:00
parent fbead7de40
commit e478e10c96
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364
3 changed files with 60 additions and 38 deletions

View file

@ -13,7 +13,7 @@ export namespace Agents {
};
export type MessageContentImageUrl = {
type: 'image_url';
type: ContentTypes.IMAGE_URL;
image_url: string | { url: string; detail?: ImageDetail };
};
@ -21,7 +21,7 @@ export namespace Agents {
| MessageContentText
| MessageContentImageUrl
// eslint-disable-next-line @typescript-eslint/no-explicit-any
| (Record<string, any> & { type?: ContentTypes | 'image_url' | 'text_delta' | string })
| (Record<string, any> & { type?: ContentTypes | string })
// eslint-disable-next-line @typescript-eslint/no-explicit-any
| (Record<string, any> & { type?: never });
@ -38,7 +38,7 @@ export namespace Agents {
/** The arguments to the tool call */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args: string | Record<string, any>;
args?: string | Record<string, any>;
/** If provided, an identifier associated with the tool call */
id?: string;
@ -50,14 +50,14 @@ export namespace Agents {
/** The Step Id of the Tool Call */
id: string;
/** The Completed Tool Call */
tool_call: ToolCall;
tool_call?: ToolCall;
/** The content index of the tool call */
index: number;
};
export type ToolCallContent = {
type: ContentTypes.TOOL_CALL;
tool_call: ToolCall;
tool_call?: ToolCall;
};
/**
@ -215,5 +215,5 @@ export namespace Agents {
*/
content?: MessageContentComplex[];
}
export type ContentType = ContentTypes.TEXT | 'image_url' | string;
export type ContentType = ContentTypes.TEXT | ContentTypes.IMAGE_URL | string;
}

View file

@ -1,5 +1,6 @@
export enum ContentTypes {
TEXT = 'text',
TEXT_DELTA = 'text_delta',
TOOL_CALL = 'tool_call',
IMAGE_FILE = 'image_file',
IMAGE_URL = 'image_url',