clientTools over webhooks (#1167)

* clientTools over webhooks

* lint

* simpler toolHook response
This commit is contained in:
Sam Machin
2025-04-23 14:15:16 +01:00
committed by GitHub
parent 63899d0091
commit 472f4f4532
2 changed files with 9 additions and 2 deletions

View File

@@ -82,8 +82,15 @@ class TaskLlm extends Task {
await this.cs?.requestor.request('llm:event', this.eventHook, data);
}
async sendToolHook(tool_call_id, data) {
await this.cs?.requestor.request('llm:tool-call', this.toolHook, {tool_call_id, ...data});
const tool_response = await this.cs?.requestor.request('llm:tool-call', this.toolHook, {tool_call_id, ...data});
// if the toolHook was a websocket it will return undefined, otherwise it should return an object
if (typeof tool_response != 'undefined') {
tool_response.type = 'client_tool_result';
tool_response.invocation_id = tool_call_id;
this.processToolOutput(tool_call_id, tool_response);
}
}
async processToolOutput(tool_call_id, data) {