-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrag.cpp
More file actions
executable file
·36 lines (29 loc) · 994 Bytes
/
rag.cpp
File metadata and controls
executable file
·36 lines (29 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "rag.hpp"
//ref: https://huggingface.co/nvidia/Llama3-ChatQA-1.5-70B
const std::string chatQAPersPrompt = "System: This is a chat between a user and an artificial intelligence assistant. The assistant gives helpful, detailed," \
"and polite answers to the user's questions based on the context. The assistant should also indicate when the answer cannot be found in the context.";
rag::rag(/* args */)
{
}
rag::~rag()
{
}
std::shared_ptr<vecdb> rag::createNewDoc(const std::string &embedName, std::vector<std::vector<float>>& vecDocs)
{
auto it = m_vecdbMap.find(embedName);
if (it == m_vecdbMap.end()) {
LOG("creating new vecdb");
auto newVecDB = std::make_shared<vecdb>(embedName, vecDocs);
m_vecdbMap[embedName] = newVecDB;
return newVecDB;
}
else
{
ERRLOG("vecdb {} already exists. unexpected", embedName);
throw;
}
}
std::string rag::getSystemMessage()
{
return chatQAPersPrompt;
}