gpt4all/gpt4all-chat/localdocssearch.h
Adam Treat 244b82622c Implement error handling for tool calls.
Signed-off-by: Adam Treat <treat.adam@gmail.com>
2024-08-14 07:43:48 -04:00

43 lines
1.0 KiB
C++

#ifndef LOCALDOCSSEARCH_H
#define LOCALDOCSSEARCH_H
#include "tool.h"
#include <QObject>
#include <QString>
class LocalDocsWorker : public QObject {
Q_OBJECT
public:
LocalDocsWorker();
virtual ~LocalDocsWorker() {}
QString response() const { return m_response; }
void request(const QList<QString> &collections, const QString &text, int count);
Q_SIGNALS:
void requestRetrieveFromDB(const QList<QString> &collections, const QString &text, int count, QString &jsonResponse);
void finished();
private:
QString m_response;
};
class LocalDocsSearch : public Tool {
Q_OBJECT
public:
LocalDocsSearch() : Tool(), m_error(ToolEnums::Error::NoError) {}
virtual ~LocalDocsSearch() {}
QString run(const QJsonObject &parameters, qint64 timeout = 2000) override;
ToolEnums::Error error() const override { return m_error; }
QString errorString() const override { return m_errorString; }
private:
ToolEnums::Error m_error;
QString m_errorString;
};
#endif // LOCALDOCSSEARCH_H