2023-04-15 19:57:32 +00:00
|
|
|
#ifndef LLAMAMODEL_H
|
|
|
|
#define LLAMAMODEL_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <functional>
|
|
|
|
#include <vector>
|
|
|
|
#include "llmodel.h"
|
|
|
|
|
|
|
|
class LLamaPrivate;
|
|
|
|
class LLamaModel : public LLModel {
|
|
|
|
public:
|
|
|
|
LLamaModel();
|
|
|
|
~LLamaModel();
|
|
|
|
|
|
|
|
bool loadModel(const std::string &modelPath) override;
|
|
|
|
bool loadModel(const std::string &modelPath, std::istream &fin) override;
|
|
|
|
bool isModelLoaded() const override;
|
2023-04-25 12:38:29 +00:00
|
|
|
void prompt(const std::string &prompt,
|
|
|
|
std::function<bool(int32_t, const std::string&)> response,
|
2023-04-25 15:20:51 +00:00
|
|
|
std::function<bool(bool)> recalculate,
|
2023-04-25 12:38:29 +00:00
|
|
|
PromptContext &ctx) override;
|
2023-04-15 19:57:32 +00:00
|
|
|
void setThreadCount(int32_t n_threads) override;
|
|
|
|
int32_t threadCount() override;
|
|
|
|
|
2023-04-25 15:20:51 +00:00
|
|
|
protected:
|
|
|
|
void recalculateContext(PromptContext &promptCtx,
|
|
|
|
std::function<bool(bool)> recalculate) override;
|
|
|
|
|
2023-04-15 19:57:32 +00:00
|
|
|
private:
|
|
|
|
LLamaPrivate *d_ptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LLAMAMODEL_H
|