| |
| LONG WINAPI LlmEnumProviders( |
| |
LPLLM_PROVIDER_INFO lpProviderList, |
|
| |
LONG nMaxProviders, |
|
| |
DWORD dwReserved |
|
| ); |
The LlmEnumProviders function returns a list of supported
service providers.
Parameters
- lpProviderList
- A pointer to an array of LLM_PROVIDER_INFO structures that will receive
information about the supported providers. This parameter may be NULL, in
which case the function only returns the number of providers.
- nMaxProviders
- The maximum number of LLM_PROVIDER_INFO structures in the array specified
by the lpProviderList parameter. If lpProviderList is NULL, this value should
be zero.
- dwReserved
- Reserved for future use. This parameter must be zero.
Return Value
If the function succeeds, the return value is the number of
providers. If the function fails, the return value is LLM_ERROR.
To get extended error information, call LlmGetLastError.
Remarks
The LlmEnumProviders function returns information about the LLM
service providers supported by the library. This includes the provider
identifier, provider name, host name, default model name, protocol, port
number, and capability flags.
To determine how many providers are available, call this function with the
lpProviderList parameter set to NULL and the nMaxProviders
parameter set to zero. If the function succeeds, the return value is the
number of providers. You can then allocate an array of LLM_PROVIDER_INFO
structures and call the function again to retrieve the provider information.
Each LLM_PROVIDER_INFO structure should have its dwSize member initialized
to the size of the structure before calling this function. This enables the
library to validate the structure version and maintain compatibility with
future releases.
The list returned by this function only identifies providers that are known
to the library. It does not verify that the provider is currently reachable,
that an account is active, or that a valid API key has been configured.
Example
LONG nProviders = LlmEnumProviders(NULL, 0, 0);
if (nProviders > 0)
{
LPLLM_PROVIDER_INFO lpProviderList;
lpProviderList = (LPLLM_PROVIDER_INFO)calloc(nProviders, sizeof(LLM_PROVIDER_INFO));
if (lpProviderList != NULL)
{
for (LONG nIndex = 0; nIndex < nProviders; nIndex++)
lpProviderList[nIndex].dwSize = sizeof(LLM_PROVIDER_INFO);
nProviders = LlmEnumProviders(lpProviderList, nProviders, 0);
if (nProviders != LLM_ERROR)
{
for (LONG nIndex = 0; nIndex < nProviders; nIndex++)
_tprintf(_T("%s\n"), lpProviderList[nIndex].szDisplayName);
}
free(lpProviderList);
}
}
else if (nProviders == LLM_ERROR)
{
DWORD dwError = LlmGetLastError();
_tprintf(_T("Unable to enumerate providers, 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
LlmGetDefaultModelName,
LlmGetProviderFlags,
LlmGetProviderInfo,
LlmGetProviderName,
LLM_PROVIDER_INFO
|
|