| INT WINAPI LlmGetDefaultModelName( |
| |
DWORD dwProviderId
| |
| |
LPTSTR lpszModelName, |
|
| |
INT nMaxLength |
|
| ); |
The LlmGetDefaultModelName function returns the name of the
default model for a service provider.
Parameters
- dwProviderId
- The identifier of the provider whose default model name will be
returned.
- lpszModelName
- A pointer to a buffer that receives the default model name. This
parameter may be NULL, in which case the function returns the length of the
model name without copying it.
- nMaxLength
- The size of the buffer specified by the lpszModelName parameter, in
characters. If lpszModelName is NULL, this value should be zero.
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 LlmGetDefaultModelName function returns the default model name
associated with the specified provider. This is the model that will be used
if a session is created or connected without explicitly specifying a model
name. In most cases, the default model is selected to provide a balance of
performance and cost, typically favoring smaller, faster models that are
suitable for general use. For more information about providers and their
default models, refer to the
Large Language Model Providers section.
Applications can call this function to determine a suitable default model
for a provider, or to present a default selection to the user. The default
model may change over time as providers update or replace their models.
If the lpszModelName parameter is NULL, the function returns the
length of the model name, in characters, not including the terminating null
character. This allows an application to determine the required buffer size
before retrieving the string.
The model name is returned as a null-terminated string. If a buffer is
provided but is not large enough to receive the entire string, the function
fails and sets the error code to ST_ERROR_BUFFER_TOO_SMALL. A buffer of
128 characters is typically sufficient for most model names.
Example
INT cchModelName = LlmGetDefaultModelName(LLM_PROVIDER_OPENAI, NULL, 0);
if (cchModelName > 0)
{
LPTSTR lpszModelName;
lpszModelName = (LPTSTR)malloc((cchModelName + 1) * sizeof(TCHAR));
if (lpszModelName != NULL)
{
if (LlmGetDefaultModelName(LLM_PROVIDER_OPENAI, lpszModelName, cchModelName + 1) > 0)
{
_tprintf(_T("The default model is %s\n"), lpszModelName);
}
free(lpszModelName);
}
}
else
{
DWORD dwError = LlmGetLastError();
_tprintf(_T("Unable to retrieve default model name, 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
LlmEnumModels,
LlmGetDefaultModelFlags,
LlmGetModelInfo,
LlmValidateModel
|