Skip to content

Commit 9ff2b68

Browse files
Adding a custom OpenAI endpoint
1 parent 713c58b commit 9ff2b68

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Plugins/BotSharp.Plugin.OpenAI/Providers/ProviderHelper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ public static OpenAIClient GetClient(string provider, string model, IServiceProv
99
{
1010
var settingsService = services.GetRequiredService<ILlmProviderService>();
1111
var settings = settingsService.GetSetting(provider, model);
12-
var client = new OpenAIClient(new ApiKeyCredential(settings.ApiKey));
13-
return client;
12+
var options = string.IsNullOrEmpty(settings.Endpoint)
13+
? null
14+
: new OpenAIClientOptions { Endpoint = new Uri(settings.Endpoint) };
15+
return new OpenAIClient(new ApiKeyCredential(settings.ApiKey), options);
1416
}
1517

1618
public static List<RoleDialogModel> GetChatSamples(List<string> lines)

0 commit comments

Comments
 (0)