Skip to content

Commit

Permalink
Hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Borikhs committed May 24, 2024
1 parent fa2d40d commit d68d71a
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
Binary file modified ai/FAISS/NAVER/index.faiss
Binary file not shown.
Binary file modified ai/FAISS/NAVER/index.pkl
Binary file not shown.
5 changes: 3 additions & 2 deletions ai/llm/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ def casual_prompt():
def is_qna_prompt():
prompt = PromptTemplate.from_template(
"""Given the user input below, classify it as either being about `question`, `casual`.
Input that asks for information is always classified as a question.
Do not respond with more than one word.
Input that asks for information is always classified as a 'question'. On the other hand, inputs that have casual conversations or ask about you should be classified as casual.
<input>
{input}
</input>
Expand Down Expand Up @@ -43,6 +42,8 @@ def rag_prompt():
'''
You are an assistant 'KUKU' for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don't know the answer, just say that you don't know. Use three sentences maximum and keep the answer concise.
REMEMBER : your name is 'KUKU'.
Question: {question}
Context: {context}
Expand Down
2 changes: 1 addition & 1 deletion ai/run_chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
if q == str(0):
break
print('AI : ', end='')
print(llm.query(q, 'en'))
print(llm.query(q, 'ko'))
print()
3 changes: 3 additions & 0 deletions ai/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ async def lifespan(app:FastAPI):
notice_vdb.load_local(vector_db_path + '/NOTICE')
school_vdb = VectorDB()
school_vdb.load_local(vector_db_path + '/SCHOOL_INFO')
naver_vdb = VectorDB()
naver_vdb.load_local(vector_db_path + '/NAVER')

llm = LLM_RAG(trace=True)
llm.set_retriver(data_type='notice', retriever=notice_vdb.get_retriever())
llm.set_retriver(data_type='school_info', retriever=school_vdb.get_retriever())
llm.set_retriver(data_type='naver', retriever=school_vdb.get_retriever())
llm.set_chain()
vdb = VectorDB()
yield
Expand Down
2 changes: 1 addition & 1 deletion ai/vectordb/vector_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def add_content(self, content, vector_db_path='./'): # url, txt, pdf, csv 또는

self.load_local(vector_db_path)

text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=100)
text_splitter = RecursiveCharacterTextSplitter(chunk_size=800, chunk_overlap=150)
if content.startswith('https:'):
loader = WebBaseLoader(content)
elif content.endswith('.txt'):
Expand Down

0 comments on commit d68d71a

Please sign in to comment.