( func: FunctionCall, tools: ToolCollection )
| 65 | export const tools: ToolCollection = {}; |
| 66 | |
| 67 | export async function handleFunctionExecution( |
| 68 | func: FunctionCall, |
| 69 | tools: ToolCollection |
| 70 | ): Promise<TaskResult> { |
| 71 | try { |
| 72 | let funcR: unknown = await tools[func.name].function(func.arguments); |
| 73 | funcR = bigIntToString(funcR); |
| 74 | const result: TaskResult = { |
| 75 | type: 'ToolResult', |
| 76 | toolResult: { result: dump(funcR) }, |
| 77 | }; |
| 78 | return result; |
| 79 | } catch (error) { |
| 80 | return { |
| 81 | type: 'ToolError', |
| 82 | toolResult: { error: JSON.stringify(error) }, |
| 83 | }; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | tools.webBrowser = seleniumBrowser; |
| 88 |
no test coverage detected