| |
| INT WINAPI LlmGetProviderUrl( |
| |
DWORD dwProviderId, |
|
| |
LPCTSTR lpszBaseUrl, |
|
| |
INT nMaxLength |
|
| ); |
The LlmGetProviderUrl function returns the default endpoint
URL for the specified provider.
Parameters
- dwProviderId
- Specifies the service provider. This parameter must be one of the
LLM_PROVIDER constants. Refer to the
providers page for a list of supported
providers and their default models.
- lpszBaseUrl
- A pointer to a buffer that receives the default base endpoint URL
used when making requests to the provider. If this parameter is NULL,
the function will return the length of the URL without copying to
the string buffer.
- nMaxLength
- The size of the buffer specified by the lpszBaseUrl parameter, in
characters. If lpszBaseUrl is NULL, this value should be zero.
If a buffer is provided, it must be large enough to store the complete URL,
including the terminating null character.
Return Value
If the function succeeds, the return value is the number of
characters copied into the string buffer, not including the terminating
null character. If the function fails, the return value is zero.
To get extended error information, call LlmGetLastError.
Remarks
The LlmGetProviderUrl function returns the default endpoint URL used when a client
sends a request to the provider. If
the provider ID is unknown or does not have a default endpoint, this
function will return zero. If the provider does not have a default
endpoint, the last error code will be set to ST_ERROR_NO_PROVIDER_BASE_URL.
In this case, a client must always provide a URL endpoint.
To return the base endpoint URL being used with a client session,
use the LlmGetClientProvider function. The LlmGetProviderUrl
function does not require an active client session and will only return
the default endpoint for a specific provider. It will not return a custom
endpoint specified for a provider.
The base URL is returned as a null-terminated string. If the buffer is not
large enough to receive the entire string, the function fails and sets the
error code to ST_ERROR_BUFFER_TOO_SMALL. We recommend a buffer size of at
least 256 characters when retrieving the base URL.
Example
DWORD dwProviderId = LLM_PROVIDER_OPENAI;
TCHAR szDefaultUrl[256] = {0};
INT cchDefaultUrl = LlmGetProviderUrl(dwProviderId, szDefaultUrl, _countof(szDefaultUrl));
if (cchDefaultUrl > 0)
{
_tprintf(_T("The default endpoint for provider %lu is %s\n"), dwProviderId, szDefaultUrl);
}
else
{
DWORD dwError = LlmGetLastError();
_tprintf(_T("Unable to get the provider endpoint, error 0x%08lx\n"), dwError);
}
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csllmv12.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
LlmGetClientProvider,
LlmGetProviderFlags,
LlmGetProviderInfo,
LlmGetProviderName
|
|