AIProvider Class |
public abstract class AIProvider : IAIProvider
The AIProvider type exposes the following members.
| Name | Description | |
|---|---|---|
| AIProvider | Initializes a new instance of the AIProvider class |
| Name | Description | |
|---|---|---|
| GUID | Unique identifier for this provider instance. | |
| LastUsage | Token usage of the last API call (input/output tokens, one call). Zeroes when the API did not report usage information. |
| Name | Description | |
|---|---|---|
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) | |
| GetAIProvider | Creates, initialises, and returns a provider for the given providerType. | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetProvider | Resolves a provider configuration by name, creates it, and returns it. Pass null or empty to use the default provider (set via DefaultProviderGUID). | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| HandleChat | Sends messages to the AI and returns the agent reply. The reply is automatically appended to messages. | |
| HandleChatWithTools | Sends messages together with available tools to the AI. If the model decides to invoke one or more tools the descriptors are placed in toolCalls and the method returns Empty; the agent message (with embedded tool-call data) is appended to messages automatically so the conversation can be continued after the caller executes the tools. If the model produces a text reply the reply is appended to messages and returned. | |
| Initialize | Configures the provider with the endpoint URL, API key, model name, and generation parameters. Called internally by GetAIProvider(ProviderType, String, String, String, Single, Int32, Single) immediately after construction. | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
| SetLastUsage | Records the token usage of the API call that just completed. | |
| ToString | Returns a string that represents the current object. (Inherited from Object) |
| Name | Description | |
|---|---|---|
| _apiKey | API key used to authenticate against the provider. | |
| _endpoint | Resource endpoint URL of the provider API. | |
| _maxTokens | Maximum number of tokens to generate (0 = provider default). | |
| _model | Name of the model to use (e.g. gpt-4o, claude-3-5-sonnet-20241022, llama3). | |
| _temperature | Sampling temperature (0.0 = default, deterministic). | |
| _topP | Nucleus sampling probability (1.0 = default, disabled). |