Click or drag to resize

OpenAIProvider Class

AI provider implementation for the OpenAI Chat Completions REST API.
Inheritance Hierarchy
SystemObject
  Seal.AIAIProvider
    Seal.AIOpenAIProvider

Namespace: Seal.AI
Assembly: SealLibrary (in SealLibrary.dll) Version: 10.0.1.0+a44cd3a7f03c2bf3cdbd971a878c679e40bed08a
Syntax
C#
public class OpenAIProvider : AIProvider

The OpenAIProvider type exposes the following members.

Constructors
 NameDescription
Public methodOpenAIProvider Initializes a new OpenAI provider.
Top
Properties
 NameDescription
Public propertyGUIDUnique identifier for this provider instance.
(Inherited from AIProvider)
Public propertyLastUsage Token usage of the last API call (input/output tokens, one call). Zeroes when the API did not report usage information.
(Inherited from AIProvider)
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodHandleChat Sends messages to the AI and returns the agent reply. The reply is automatically appended to messages.
(Overrides AIProviderHandleChat(ListChatMessage))
Public methodHandleChatWithTools 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.
(Overrides AIProviderHandleChatWithTools(ListChatMessage, IListAITool, IListAIToolCall))
Protected methodInitialize 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.
(Overrides AIProviderInitialize(String, String, String, Single, Int32, Single))
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Protected methodSetLastUsage Records the token usage of the API call that just completed.
(Inherited from AIProvider)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Fields
 NameDescription
Protected field_apiKeyAPI key used to authenticate against the provider.
(Inherited from AIProvider)
Protected field_endpointResource endpoint URL of the provider API.
(Inherited from AIProvider)
Protected field_maxTokensMaximum number of tokens to generate (0 = provider default).
(Inherited from AIProvider)
Protected field_modelName of the model to use (e.g. gpt-4o, claude-3-5-sonnet-20241022, llama3).
(Inherited from AIProvider)
Protected field_temperatureSampling temperature (0.0 = default, deterministic).
(Inherited from AIProvider)
Protected field_topPNucleus sampling probability (1.0 = default, disabled).
(Inherited from AIProvider)
Top
See Also