|
The SocketTools Large Language Model (LLM) ActiveX control enables your
application to interact with modern AI services to generate text, answer
questions, and process natural language input. The control provides a
common interface that can be used with both cloud-based services and locally
hosted models, without requiring your application to work directly
with each provider's API.
The control manages the provider-specific details of creating requests,
managing connections, formatting prompts, and returning responses. This allows
your application to focus on how the generated content is used, rather than
the details of how each provider implements its service.
Several cloud-based and local providers are supported. For an
overview of currently available services and their capabilities, please
refer to the providers
page. If you are new to development with large language models, the
glossary of terms provides definitions
for common concepts used throughout this documentation.
Getting Started
Most applications begin by selecting a provider, specifying a model, and
providing any required authentication credentials. For cloud-based providers,
this typically requires an API key. For locally hosted providers, the
BaseUrl property is used to specify the local server endpoint.
Provider Property
All service providers are associated with a unique identifier.
When you set this property, the value of the ProviderName
property will change to return a short, friendly name for the
provider. Likewise, changing the value of the ProviderName
property will automatically change the value of this property. Your
application can use either property to select a service provider.
ModelName Property
Specifies the model used when sending requests to the provider.
ApiKey Property
Specifies the API key used to authenticate requests with the selected
provider.
BaseUrl Property
Specifies the base URL for the provider endpoint. This is most commonly
used with local servers or custom provider endpoints.
Connect Method
Connects to the selected provider using the current property values.
Disconnect Method
Disconnects from the current provider and closes the active session
connection.
Prompts and Responses
The primary purpose of the control is to send a prompt to a model and
return the generated response. Applications can pass the prompt directly to
a method, or set the Prompt property and then read the generated
text from the Response property after the method returns.
In the documentation, you'll see references to both prompts
and messages. A prompt refers to the text sent to the model
containing a request or instructions. Internally, the control represents
this input as a message, which includes the prompt text and
response, along with additional metadata such as the role and other options.
A message turn is the combination of a single prompt and response. A
conversation consists of all of the messages exchanged with the
model.
Prompt Property
Specifies the most recent prompt sent to the model.
Response Property
Returns the response to the most recent prompt sent to the model.
Ask Method
Sends a single prompt to the current provider and returns a response.
This method does not require you to connect to a provider, and does not
preserve the prompt and response in the conversation history.
SendMessage Method
Sends a prompt to the current model and returns the response,
along with a message identifier.
This method requires you to create a session by calling the Connect
method. The prompt and response are retained in the control's conversation
history. This allows you to send a series of prompts to a model and
retrieve the responses, while maintaining context for the
conversation.
Cancel Method
Cancels the current request if an operation is in progress.
Conversation History
The control can preserve message history so applications can build
multi-turn conversations. Each prompt and response is stored as a message
exchange and assigned a message identifier. This history can be enumerated,
searched, trimmed, cleared, exported, and imported.
HistorySize Property
Specifies the maximum number of message exchanges retained in the client
history.
MessageCount Property
Returns the number of messages currently stored in the conversation
history.
MessageId Property
Returns the message identifier assigned to the most recent prompt and
response.
GetMessage Method
Retrieves a specific message prompt and response using a message
identifier.
FindMessage Method
Searches the client history for a message or response that matches the
specified text.
GetFirstMessage Method
Retrieves the first message and response from the client history.
GetNextMessage Method
Retrieves the next message and response from the client history.
TrimHistory Method
Removes older messages from the conversation history.
ClearHistory Method
Removes all messages and responses from the client history.
Providers and Models
The control provides methods and properties that make it possible to select
a provider, enumerate available models, retrieve provider information, and
validate model names. This allows applications to present provider and model
options to the user, or dynamically adapt to the capabilities of a selected
service.
ProviderName Property
Specifies the name of the provider used to establish a connection. The
names are short, easily recognized string values. Examples would be
"OpenAI" or "Anthropic".
ProviderFlags Property
Returns the capability and requirement flags associated with the selected
provider.
DefaultModel Property
Returns the default model name for the current provider.
ModelFlags Property
Returns or changes the capability flags associated with the current model.
GetProvider Method
Returns information about a provider, including its name, endpoint, default
model, and flags.
GetFirstModel Method
Retrieves the first model available for the current provider.
GetNextModel Method
Retrieves the next model available for the current provider.
ValidateModel Method
Validates a model name for the current provider.
Generation Options
The response generated by a model can be influenced by several properties.
These include the system prompt, maximum token count, temperature, reasoning
level, and other sampling options. In most cases, the default values are
appropriate, but these properties can be used when your application needs more
control over how responses are generated.
SystemPrompt Property
Specifies instructions that help define how the model should respond.
MaxTokens Property
Specifies the maximum number of tokens that may be generated for a
response.
Temperature Property
Specifies the sampling temperature used to control response variability.
ReasoningLevel Property
Specifies the preferred reasoning effort level used for models that support
reasoning.
TopP Property
Specifies the nucleus sampling value used to control token selection.
TopK Property
Specifies the top-k sampling value used by providers and models that support
it.
Options Property
Specifies connection and session options used by the control.
|