|
| 1 | +export class ToolParameterProperty { |
| 2 | + type: string; |
| 3 | + description: string | null; |
| 4 | + |
| 5 | + constructor(type: string, description: string | null) { |
| 6 | + this.type = type; |
| 7 | + this.description = description; |
| 8 | + } |
| 9 | +} |
| 10 | + |
| 11 | +export class ToolParameters { |
| 12 | + type: string; |
| 13 | + properties: Map<string, ToolParameterProperty>; |
| 14 | + required: string[] | null; |
| 15 | + |
| 16 | + constructor( |
| 17 | + type: string, |
| 18 | + properties: Map<string, ToolParameterProperty>, |
| 19 | + required: string[] | null, |
| 20 | + ) { |
| 21 | + this.type = type; |
| 22 | + this.properties = properties; |
| 23 | + this.required = required; |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +export class ToolMetadata { |
| 28 | + name: string; |
| 29 | + description: string; |
| 30 | + parameters: ToolParameters | null; |
| 31 | + argsKwargs: Map<string, Object> | null; |
| 32 | + |
| 33 | + constructor( |
| 34 | + name: string, |
| 35 | + description: string, |
| 36 | + parameters: ToolParameters | null, |
| 37 | + argsKwargs: Map<string, Object> | null, |
| 38 | + ) { |
| 39 | + this.name = name; |
| 40 | + this.description = description; |
| 41 | + this.parameters = parameters; |
| 42 | + this.argsKwargs = argsKwargs; |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +export class BaseTool { |
| 47 | + call(_args: Object): Object { |
| 48 | + return {}; |
| 49 | + } |
| 50 | + metadata: ToolMetadata | null = null; |
| 51 | + |
| 52 | + constructor(metadata: ToolMetadata) { |
| 53 | + this.metadata = metadata; |
| 54 | + } |
| 55 | +} |
0 commit comments