LLMModelListModel

The models that a user can pick, as a list for a QListView (llm-openai-compatible §OCP-G4).

Inherits QAbstractListModel
Group libllm

Declared in src/libs/libllm/llm/ui/LLMModelListModel.hpp.

Detailed description

A row is an enabled model of an enabled provider, in the registry's order. setProviderScope() keeps the models of one provider only. The model keeps the ids, and data() reads the registry, so the memory of a row is one id. It follows the registry's signals: a change of one model updates its row, or inserts or removes it. A full reset happens only on reload().

See also LLMModelFilter, LLMSelectActivity, LLMRegistryModel.

Member function documentation

matchingRows

std::vector<bool> LLMModelListModel::matchingRows(const QString &text) const

Returns whether each row matches text, as rowMatches() says, from one pass over the registry's models. The rows and the registry's models are in the same order, the order of the ids, so the pass needs no lookup.

providersNamed

QSet<QString> LLMModelListModel::providersNamed(const QString &text) const

Returns the ids of the providers whose name holds text, with no regard to case.

reload

void LLMModelListModel::reload()

Read the ids of the registry again: the one full reset of the model.

rowMatches

bool LLMModelListModel::rowMatches(int row, const QString &text, const QSet<QString> &providers) const

Returns whether the model of row has text in its name or its model id, or belongs to one of providers.

rowOf

int LLMModelListModel::rowOf(const QString &modelId) const

Returns the row of modelId, or -1.

setProviderScope

void LLMModelListModel::setProviderScope(const QString &providerId)

List only the models of the provider providerId, or every provider's when it is empty.

setRegistry

void LLMModelListModel::setRegistry(QSharedPointer<LLMRegistry> registry)

List the models of registry, and follow its signals.

In this section