94 struct LoggingContextPimpl;
159 struct LlamaAsyncImpl;
184 static bool Save(
const std::string& data,
const std::string& path);
196 static bool Save(
unsigned char* data,
long data_length,
const std::string& path);
209 static bool Save(
const char* data, std::size_t data_length,
const std::string& path);
Manages callback functions for logging, token processing, and completion events.
Definition lib.h:82
LoggingContext()
Constructs a new LoggingContext object.
~LoggingContext()
Destructs the LoggingContext object, cleaning up any allocated resources.
LoggingContextPimpl * pImpl
The PImpl structure containing private implementation details.
Definition lib.h:95
Provides an interface for asynchronous inference operations on a model, such as GPT.
Definition lib.h:107
std::string GetGenerationResults(int task_id)
Retrieves the generated text associated with a task ID.
bool GetSetupResults(int task_id)
Retrieves the result of the setup operation associated with a task ID.
AsyncLlamaInfrence()
Default constructor for the AsyncLlamaInfrence class.
int SetupAsync(const LoggingContext *logging, const gpt_params &cfg_params)
Asynchronously sets up the model with specified configuration LLama.cpp parameters.
int GenerateAsync(const std::string &prompt)
Asynchronously generates output based on the provided prompt.
bool IsGenerationReady(int task_id)
LlamaAsyncImpl * pImpl
Pointer to the implementation class, used by the PImpl idiom.
Definition lib.h:164
~AsyncLlamaInfrence()
Destructor for the AsyncLlamaInfrence class.
Provides static utility functions for saving data to files.
Definition lib.h:174
static bool Save(const std::string &data, const std::string &path)
Saves string data to a file.
static bool Save(unsigned char *data, long data_length, const std::string &path)
Saves binary data to a file.
static bool Save(const char *data, std::size_t data_length, const std::string &path)
Saves data to a file.
Provides an interface for inference operations on a model, such as GPT (yet any LLama....
Definition lib.h:16
bool Generate(const std::string &prompt)
Generates output based on the provided prompt.
~LlamaInfrence()
destructor to allow for proper cleanup in derived classes. Does cleanup.
LlamaInfrence(const LoggingContext *logging, const gpt_params &cfg_params)
Sets up the model with specified configuration LLama.cpp parameters that can include file (to load fr...
void Echo(std::string in)
void Stop()
Stops the current generation operation. To be called from callbacks for text length generation contro...
std::string GetGenerated()
Retrieves the complete generated text after a generation call. On generation call string is emptied.
static gpt_params * GetParameters(const std::string &llamacpp_cmd_args)
Generates model config using a string that contains command-line-like arguments same as in original L...
LlamaImpl * pImpl
Pointer to the implementation class, used by the PImpl idiom.
Definition lib.h:64
Definition common-base.h:38