Refactored ParseApiParameters to use params for improved parameter handling

This commit is contained in:
Thorsten Sommer 2025-11-13 16:28:21 +01:00
parent f0ba5b3671
commit 4f82b42ff1
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,7 @@ public sealed class ProviderAnthropic() : BaseProvider("https://api.anthropic.co
yield break; yield break;
// Parse the API parameters: // Parse the API parameters:
var apiParameters = this.ParseApiParameters(this.AdditionalJsonApiParameters, ["system"]); var apiParameters = this.ParseApiParameters(this.AdditionalJsonApiParameters, "system");
// Prepare the Anthropic HTTP chat request: // Prepare the Anthropic HTTP chat request:
var chatRequest = JsonSerializer.Serialize(new ChatRequest var chatRequest = JsonSerializer.Serialize(new ChatRequest

View File

@ -526,7 +526,7 @@ public abstract class BaseProvider : IProvider, ISecretId
/// <param name="keysToRemove">Optional list of keys to remove from the final dictionary (case-insensitive). stream, model and messages are removed by default.</param> /// <param name="keysToRemove">Optional list of keys to remove from the final dictionary (case-insensitive). stream, model and messages are removed by default.</param>
protected IDictionary<string, object> ParseApiParameters( protected IDictionary<string, object> ParseApiParameters(
string additionalUserProvidedParameters, string additionalUserProvidedParameters,
IEnumerable<string>? keysToRemove = null) params IEnumerable<string> keysToRemove)
{ {
try try
{ {

View File

@ -87,7 +87,7 @@ public sealed class ProviderOpenAI() : BaseProvider("https://api.openai.com/v1/"
// Parse the API parameters: // Parse the API parameters:
var apiParameters = this.ParseApiParameters(this.AdditionalJsonApiParameters, ["input", "store", "tools"]); var apiParameters = this.ParseApiParameters(this.AdditionalJsonApiParameters, "input", "store", "tools");
// //
// Create the request: either for the Responses API or the Chat Completion API // Create the request: either for the Responses API or the Chat Completion API