Add EndSessionTool (no params, returns ok; relay closes on this tool name)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace backend.Tools;
|
||||
|
||||
public class EndSessionTool : ITool
|
||||
{
|
||||
public string Name => "end_session";
|
||||
public string Description =>
|
||||
"Call this when the user has said goodbye or otherwise indicates the conversation is over.";
|
||||
public bool RunsDuringResponse => false;
|
||||
|
||||
public JsonElement ParameterSchema { get; } =
|
||||
JsonDocument.Parse("""{"type":"object","properties":{},"required":[]}""").RootElement;
|
||||
|
||||
public Task<ToolResult> ExecuteAsync(ToolInvocation invocation, DeviceContext device, CancellationToken ct)
|
||||
{
|
||||
var output = JsonDocument.Parse("""{"ok":true}""").RootElement;
|
||||
return Task.FromResult(new ToolResult(output));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user