The BaseUrl property is a String value that specifies the base
URL endpoint used when communicating with the selected provider. The base
URL identifies the server and API endpoint that will receive requests
generated by the control. If you do not change this property, it
will return the default endpoint used for the service provider
specified by the Provider property.
For most cloud providers, the control automatically uses an appropriate
default endpoint and this property does not need to be explicitly set.
However, applications may need to set this property when using a locally
hosted model, a self-hosted service, or a custom provider
deployment.
For example, locally hosted model servers such as LM Studio or Ollama
commonly expose an OpenAI-compatible endpoint using a URL similar to:
"http://127.0.0.1:1234/v1/"
Applications using Microsoft Foundry or Azure OpenAI deployments must
specify the endpoint URL assigned to the deployment because those services
do not use a single shared public endpoint.
To determine the endpoint URL for a Microsoft Foundry or Azure OpenAI
deployment, refer to the Azure portal for the resource or deployment. The
portal will provide the endpoint URL and API key values associated with the
deployment. In managed enterprise environments, these values may be provided
by the administrator responsible for the Azure or Foundry resources.
In most cases, applications should use the default endpoint associated
with the selected provider. Providing an incorrect endpoint URL may prevent
the control from connecting to the service provider. If this property is
set to an empty string, the control will revert to using the default
endpoint associated with the selected provider.
LlmClient1.ProviderName = "Local"
LlmClient1.BaseUrl = "http://127.0.0.1:1234/v1/"
LlmClient1.ModelName = "mistralai/mistral-7b-instruct-v0.3"
If LlmClient1.Connect() Then
LlmClient1.Prompt = "How do you calculate the volume of a sphere?"
If LlmClient1.SendMessage() Then
MsgBox LlmClient1.Response, vbInformation, "Message " & LlmClient1.MessageId
Else
MsgBox LlmClient1.LastErrorString, vbExclamation, "Error"
End If
LlmClient1.Disconnect
Else
MsgBox LlmClient1.LastErrorString, vbExclamation, "Error"
End If