KTextAddons

ollamamanager.h
1/*
2 SPDX-FileCopyrightText: 2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ollamarequest.h"
10
11#include <QDebug>
12#include <QObject>
13class OllamaReply;
14class OllamaManager : public QObject
15{
17public:
18 struct ModelsInfo {
19 QStringList models;
20 QString errorOccured;
21 bool hasError = false;
22 bool isReady = false;
23 };
24
25 explicit OllamaManager(QObject *parent = nullptr);
26 ~OllamaManager() override;
27 void loadModels();
28 [[nodiscard]] OllamaReply *getCompletion(const OllamaRequest &request);
29
30 static OllamaManager *self();
31
32 void downloadModel(const QString &modelName);
34 void modelsLoadDone(const ModelsInfo &models);
35 void finished(const QString &replyText);
36
37private:
38 QMetaObject::Connection mOllamaCheckConnect;
39};
40Q_DECLARE_TYPEINFO(OllamaManager::ModelsInfo, Q_RELOCATABLE_TYPE);
41QDebug operator<<(QDebug d, const OllamaManager::ModelsInfo &t);
The OllamaReply class represents a reply from an LLM.
Definition ollamareply.h:48
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 12:06:13 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.