Constructor OpenAIProvider
- Namespace
- IntentSharp.Providers
- Assembly
- IntentSharp.dll
OpenAIProvider(string, string?, HttpClient?, ILogger?)
Creates the provider with an API key and the default settings.
public OpenAIProvider(string apiKey, string? model = null, HttpClient? httpClient = null, ILogger? logger = null)
Parameters
apiKeystringThe OpenAI API key.
modelstringThe model used when a request names none. Null uses DefaultModelId.
httpClientHttpClientThe client to send requests with. Null creates one that the provider owns and disposes; a supplied client is never disposed by the provider and keeps its own timeout (see Timeout).
loggerILoggerReceives a
Warningfor every retry. Null discards them.
Exceptions
- ArgumentException
apiKeyis null, empty or white space.
OpenAIProvider(HttpProviderSettings, HttpClient?, ILogger?)
Creates the provider from full settings.
public OpenAIProvider(HttpProviderSettings settings, HttpClient? httpClient = null, ILogger? logger = null)
Parameters
settingsHttpProviderSettingsThe API key, model, address, timeout and retry settings.
httpClientHttpClientThe client to send requests with. Null creates one that the provider owns and disposes; a supplied client is never disposed by the provider and keeps its own timeout (see Timeout).
loggerILoggerReceives a
Warningfor every retry. Null discards them.
Exceptions
- ArgumentNullException
settingsis null.- ArgumentException
The settings have no API key or no model.