mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
clientTools over webhooks (#1167)
* clientTools over webhooks * lint * simpler toolHook response
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -219,7 +219,7 @@ class HttpRequestor extends BaseRequestor {
|
||||
const rtt = this._roundTrip(startAt);
|
||||
if (buf) this.stats.histogram('app.hook.response_time', rtt, ['hook_type:app']);
|
||||
|
||||
if (buf && Array.isArray(buf)) {
|
||||
if (buf && (Array.isArray(buf) || type == 'llm:tool-call')) {
|
||||
this.logger.info({response: buf}, `HttpRequestor:request ${method} ${url} succeeded in ${rtt}ms`);
|
||||
return buf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user