mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
This commit is contained in:
@@ -307,6 +307,21 @@ export abstract class BaseDeclarativeTool<
|
||||
*/
|
||||
export type AnyDeclarativeTool = DeclarativeTool<object, ToolResult>;
|
||||
|
||||
/**
|
||||
* Type guard to check if an object is a Tool.
|
||||
* @param obj The object to check.
|
||||
* @returns True if the object is a Tool, false otherwise.
|
||||
*/
|
||||
export function isTool(obj: unknown): obj is AnyDeclarativeTool {
|
||||
return (
|
||||
typeof obj === 'object' &&
|
||||
obj !== null &&
|
||||
'name' in obj &&
|
||||
'build' in obj &&
|
||||
typeof (obj as AnyDeclarativeTool).build === 'function'
|
||||
);
|
||||
}
|
||||
|
||||
export interface ToolResult {
|
||||
/**
|
||||
* Content meant to be included in LLM history.
|
||||
|
||||
Reference in New Issue
Block a user