If the method succeeds, the return value is the number of
characters copied into the string buffer, not including the
terminating null character. If the method fails, the return
value is zero. To get extended error information, call
GetLastError.
The GetDefaultModelName method 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 method 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 method 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 method
fails and sets the error code to ST_ERROR_BUFFER_TOO_SMALL. A buffer of
128 characters is typically sufficient for most model names.
INT cchModelName = llmClient.GetDefaultModelName(LLM_PROVIDER_OPENAI);
if (cchModelName > 0)
{
LPTSTR lpszModelName;
lpszModelName = (LPTSTR)malloc((cchModelName + 1) * sizeof(TCHAR));
if (lpszModelName != NULL)
{
if (llmClient.GetDefaultModelName(LLM_PROVIDER_OPENAI, lpszModelName, cchModelName + 1) > 0)
{
_tprintf(_T("The default model is %s\n"), lpszModelName);
}
free(lpszModelName);
}
}
else
{
DWORD dwError = llmClient.GetLastError();
_tprintf(_T("Unable to retrieve default model name, error 0x%08lx\n"), dwError);
}