mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-12 23:53:48 +00:00
Added tool calling support (#731)
Co-authored-by: krut_ni <nils.kruthoff@dlr.de> Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
266 files changed
+11186
-740
No files matched your search
@@ -0,0 +1,35 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AIStudio.Tools.ToolCallingSystem;
|
||||
|
||||
public sealed class ToolSettingsFieldDefinition
|
||||
{
|
||||
public string Type { get; init; } = "string";
|
||||
|
||||
public string Title { get; init; } = string.Empty;
|
||||
|
||||
public string Description { get; init; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("enum")]
|
||||
public List<string> EnumValues { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Name of a list of options the app maintains, as an alternative to spelling them out in
|
||||
/// the enum field. See the tool settings option sources for the available names.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Use this for values the app already knows, such as languages: it keeps the list in one
|
||||
/// place and gives the user readable names instead of raw values. Mutually exclusive with
|
||||
/// the enum field.
|
||||
/// </remarks>
|
||||
public string OptionSource { get; init; } = string.Empty;
|
||||
|
||||
public bool Secret { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The values and names to offer for this field, from whichever way it declares them.
|
||||
/// </summary>
|
||||
public IReadOnlyList<ToolSettingsOption> GetOptions() => string.IsNullOrWhiteSpace(this.OptionSource)
|
||||
? this.EnumValues.Select(value => new ToolSettingsOption(value, value)).ToList()
|
||||
: ToolSettingsOptionSources.Resolve(this.OptionSource);
|
||||
}
|
||||
Reference in new issue
Block a user