CLlmClient::GetDefaultModelName Method  
 
INT GetDefaultModelName(
  DWORD dwProviderId,  
  LPCTSTR lpszModelName,  
  INT nMaxLength  
);
INT GetDefaultModelName(
  DWORD dwProviderId,  
  CString &strModelName  
);

The GetDefaultModelName method 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 method returns the length of the model name without copying it. An alternate version of this method accepts a CString object which will contain the model name when the method returns.
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 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.

Remarks

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.

Example

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);
}

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