에러왕

[챗봇CHATBOT]데이터베이스 구축하기(DATABASE/EMBEDDING/SINGlE STORE) 본문

Chatbot

[챗봇CHATBOT]데이터베이스 구축하기(DATABASE/EMBEDDING/SINGlE STORE)

에러뿌셔 2023. 8. 7. 16:18

현재 파일을 업로드하면 문서 내용을 요약해서 알려주는 챗봇을 구현해놓은상태이다.

문제는 그냥 해외 개발자들의 레퍼런스를 참고해서 만든거기때문에, 모듈에대한 이해도 너무 없고

그냥 전반적으로 챗봇에 대한 이해도가 너무너무너무너무 없음.

 

*/data 폴더에 회사 규정같은것을 올리면 지피티가 요약을 해줘서 알려줌.

내가 만드는 웹페이지는 교육플랫폼임. 

여기서 얘가 요약하는 원리가 어떤거냐면..

 

언어모델인 "gpt-3.5-turbo"는 파일을 직접 읽지는 않지만, 이전에 해당 파일을 로드하여 색인화한 후, 그 색인을 사용하여 질문에 대한 답변을 생성합니다.

 

따라서 "data/" 디렉토리 내에 있는 텍스트 파일들이 색인화되어 질문에 대한 답변 생성에 사용됨.

일단 파일들이 색인화되면, 대화 체인이 이 색인을 활용하여 사용자의 질문에 대한 답변을 생성. 사용자가 질문을 하면 대화 체인은 해당 질문과 이전 대화 기록을 입력으로 받아 최적의 답변을 찾음. 대화 기록은 사용자와 기계 간의 이전 대화를 추적하고, 이전 답변이 다음 답변에 영향을 미치게됨.

따라서, 언어 모델인 "gpt-3.5-turbo"는 직접 파일을 읽지는 않지만, 파일에서 생성한 색인과 대화 기록을 활용하여 사용자의 질문에 대답하는 형식.

 

결국 INDEXING이 포인트. 디렉토리에 있는 파일을 지울경우 색인을 할수없으니까 없음

 

그러면 데이터 저장을 하려면? 

 

You are absolutely right. By default, GPT-3.5-turbo does not have built-in memory of previous conversations, and the chat history is maintained only during the current program execution. Once the program is restarted, the chat history is lost.

To have persistent memory of conversations or to use the chat history across different sessions or platforms, you would need to implement a mechanism to store the conversation history in an external database or file. By saving the chat history in an external storage, you can reload the history in future sessions, allowing for continuous and meaningful conversations with the model.

In summary, to achieve persistent memory of chat history, you will need to add functionality to store and load the conversation data from an external source, such as a database or a file. This way, you can maintain a longer-term conversation history and enable continuous interactions with the GPT-3.5-turbo model even across different program executions or platforms.

 

HOW TO TEST EMBEDDING USING API KEY FROM OPEN AI

 

OPENAI 키 이용해서 EMBEDDING 테스트 해보고 

 

 

SINGLESTORE에서 데이터베이스 구축

 

 

 

put some data(like sample)

 

 

 

and see the result (score)

high scores means similarity.

so I can see how vector data works.

 

 

확인!!

object : 'embedding' / array

이제 여기에다가 pdf 업로드등 기능을추가할수있다!

 

chatbot with database

'Chatbot' 카테고리의 다른 글

[AIChatbot/AWS]RAG에 대하여  (0) 2023.09.15
별안간 챗봇을 개발하게 된 것에 대하여  (0) 2023.08.03