python

[GPT] ConversationSummaryBufferMemory

으누아빠 2024. 3. 29. 19:20
반응형

ConversationSummaryBufferMemory 


메세지를 저장하다가 Token 기준으로 최대치를 넘어가면 이전 대화를 요약해서 저장

 

[결과]

{'history': [HumanMessage(content="Hi I'm Hong, I live in South Korea"), AIMessage(content='Wow that is so cool!')]}

 

만약 token 값이 max_token_limit 를 초과할 경우 SystemMessage 가 새롭게 생성되면서 이전 대화내용을 요약하여 메세지에 저장

[결과값]

{'history': [SystemMessage(content='The human introduces themselves as Hong from South Korea.'), AIMessage(content='Wow that is so cool!'), HumanMessage(content='How far is Korea from Argentina?'), AIMessage(content="I don't know! Super far!"), HumanMessage(content='How far is Brazil from Argentina?'), AIMessage(content="I don't know! Super far!"), HumanMessage(content='How far is Brazil from Japan?'), AIMessage(content="I don't know! Super far!")]}

'python' 카테고리의 다른 글

[GPT]Memory on LLMChain  (0) 2024.03.29
[GPT] ConversationKGMemory  (0) 2024.03.29
[GPT] ConversationSummaryMemory  (0) 2024.03.29
[GPT] ConversationBufferWindowMemory  (0) 2024.03.29
[GPT] ConversationBufferMemory  (0) 2024.03.29