mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-05-20 14:12:15 +00:00
Renamed Tools to ProviderTools as a preparation for the implementation of local tool calling
This commit is contained in:
parent
6155442039
commit
e5a9b32245
@ -79,9 +79,9 @@ public sealed class ProviderOpenAI() : BaseProvider(LLMProviders.OPEN_AI, "https
|
||||
//
|
||||
// Prepare the tools we want to use:
|
||||
//
|
||||
IList<Tool> tools = modelCapabilities.Contains(Capability.WEB_SEARCH) switch
|
||||
IList<ProviderTool> providerTools = modelCapabilities.Contains(Capability.WEB_SEARCH) switch
|
||||
{
|
||||
true => [ Tools.WEB_SEARCH ],
|
||||
true => [ ProviderTools.WEB_SEARCH ],
|
||||
_ => []
|
||||
};
|
||||
|
||||
@ -178,7 +178,7 @@ public sealed class ProviderOpenAI() : BaseProvider(LLMProviders.OPEN_AI, "https
|
||||
Store = false,
|
||||
|
||||
// Tools we want to use:
|
||||
Tools = tools,
|
||||
ProviderTools = providerTools,
|
||||
|
||||
// Additional API parameters:
|
||||
AdditionalApiParameters = apiParameters
|
||||
@ -290,4 +290,4 @@ public sealed class ProviderOpenAI() : BaseProvider(LLMProviders.OPEN_AI, "https
|
||||
var modelResponse = await response.Content.ReadFromJsonAsync<ModelsResponse>(token);
|
||||
return modelResponse.Data.Where(model => prefixes.Any(prefix => model.Id.StartsWith(prefix, StringComparison.InvariantCulture)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
namespace AIStudio.Provider.OpenAI;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a tool used by the AI model.
|
||||
/// Represents a tool executed on the provider side.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Right now, only our OpenAI provider is using tools. Thus, this class is located in the
|
||||
@ -9,4 +9,4 @@ namespace AIStudio.Provider.OpenAI;
|
||||
/// be moved into the provider namespace.
|
||||
/// </remarks>
|
||||
/// <param name="Type">The type of the tool.</param>
|
||||
public record Tool(string Type);
|
||||
public record ProviderTool(string Type);
|
||||
@ -1,14 +1,14 @@
|
||||
namespace AIStudio.Provider.OpenAI;
|
||||
|
||||
/// <summary>
|
||||
/// Known tools for LLM providers.
|
||||
/// Known provider-side tools for LLM providers.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Right now, only our OpenAI provider is using tools. Thus, this class is located in the
|
||||
/// OpenAI namespace. In the future, when other providers also support tools, this class can
|
||||
/// be moved into the provider namespace.
|
||||
/// </remarks>
|
||||
public static class Tools
|
||||
public static class ProviderTools
|
||||
{
|
||||
public static readonly Tool WEB_SEARCH = new("web_search");
|
||||
}
|
||||
public static readonly ProviderTool WEB_SEARCH = new("web_search");
|
||||
}
|
||||
@ -9,13 +9,13 @@ namespace AIStudio.Provider.OpenAI;
|
||||
/// <param name="Input">The chat messages.</param>
|
||||
/// <param name="Stream">Whether to stream the response.</param>
|
||||
/// <param name="Store">Whether to store the response on the server (usually OpenAI's infrastructure).</param>
|
||||
/// <param name="Tools">The tools to use for the request.</param>
|
||||
/// <param name="ProviderTools">The provider-side tools to use for the request.</param>
|
||||
public record ResponsesAPIRequest(
|
||||
string Model,
|
||||
IList<IMessageBase> Input,
|
||||
bool Stream,
|
||||
bool Store,
|
||||
IList<Tool> Tools)
|
||||
[property: JsonPropertyName("tools")] IList<ProviderTool> ProviderTools)
|
||||
{
|
||||
public ResponsesAPIRequest() : this(string.Empty, [], true, false, [])
|
||||
{
|
||||
@ -24,4 +24,4 @@ public record ResponsesAPIRequest(
|
||||
// Attention: The "required" modifier is not supported for [JsonExtensionData].
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalApiParameters { get; init; } = new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user