Method UseProvidersFromEnvironment
- Namespace
- IntentSharp
- Assembly
- IntentSharp.dll
UseProvidersFromEnvironment(string?, string?)
Reads ANTHROPIC_API_KEY and OPENAI_API_KEY. When the Anthropic key is set, Anthropic becomes the primary (replacing any primary already set). When the OpenAI key is set, OpenAI becomes the primary if there is none yet, otherwise the fallback.
public IntentClientBuilder UseProvidersFromEnvironment(string? openAIModel = null, string? anthropicModel = null)
Parameters
openAIModelstringanthropicModelstring
Returns
Exceptions
- ArgumentException
A provider this call registers has the name of the provider in the other role: for example OpenAI would become the fallback while the primary is already named "OpenAI" (after UseOpenAI(string, string?)).
- InvalidOperationException
Neither key is set and no primary is configured.