This is an example of using ailia LLM.
int main(int argc, char *argv[]){
struct AILIALLM* llm;
unsigned int n_ctx = 512;
std::vector<AILIALLMChatMessage> messages;
message.
content =
"語尾に「くま」をつけて回答してください。";
messages.push_back(message);
messages.push_back(message);
std::string text = "";
while(true) {
unsigned int done = 0;
break;
}
unsigned int size = 0;
std::vector<char> delta(size);
text = text + std::string(&delta[0]);
}
return 0;
}
AILIA_LLM_API int ailiaLLMSetPrompt(struct AILIALLM *llm, const AILIALLMChatMessage *message, unsigned int message_cnt)
Set the prompt.
AILIA_LLM_API int ailiaLLMGetDeltaText(struct AILIALLM *llm, char *text, unsigned int buf_size)
Gets the decoded text.
AILIA_LLM_API int ailiaLLMGetDeltaTextSize(struct AILIALLM *llm, unsigned int *buf_size)
Gets the size of text. (Include null)
AILIA_LLM_API int ailiaLLMGenerate(struct AILIALLM *llm, unsigned int *done)
Perform generate.
#define AILIA_LLM_STATUS_SUCCESS
Successful.
Definition: ailia_llm.h:38
AILIA_LLM_API int ailiaLLMOpenModelFileA(struct AILIALLM *llm, const char *path, unsigned int n_ctx)
Open model file.
AILIA_LLM_API int ailiaLLMCreate(struct AILIALLM **llm)
Creates a LLM instance.
AILIA_LLM_API void ailiaLLMDestroy(struct AILIALLM *llm)
It destroys the LLM instance.
Definition: ailia_llm.h:166
const char * content
Represent the content of the message.
Definition: ailia_llm.h:174
const char * role
Represent the role. (system, user, assistant)
Definition: ailia_llm.h:170