Skip to content

Commit

Permalink
Delegate tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Jun 5, 2024
1 parent 2b4cd25 commit 70848af
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageProjectUrl>https://github.com/squidex/squidex</PackageProjectUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>6.10.0</Version>
<Version>6.11.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
27 changes: 27 additions & 0 deletions ai/Squidex.AI/DelegateChatTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

namespace Squidex.AI;

public sealed class DelegateChatTool : IChatTool
{
private readonly Func<ToolContext, CancellationToken, Task<string>> action;

public ToolSpec Spec { get; }

public DelegateChatTool(ToolSpec spec, Func<ToolContext, CancellationToken, Task<string>> action)
{
Spec = spec;

this.action = action;
}

public Task<string> ExecuteAsync(ToolContext toolContext, CancellationToken ct)
{
return action(toolContext, ct);
}
}

0 comments on commit 70848af

Please sign in to comment.