HamaWhiteGG / langchain-java

Java version of LangChain, while empowering LLM for Big Data.
Apache License 2.0
551 stars 107 forks source link

support load limited messages from chat memory #52

Closed zhangxiaojiawow closed 1 year ago

zhangxiaojiawow commented 1 year ago

Since the token we input to LLM is limited, the history messages we add into gpt request is also limited.

This merge request defines the interface MemoryMessagePicker, it can pick up needed chat messages from memory. We also provide an implementation of this interface BufferWindowMemoryMessagePicker, which will pick up lastest 2*K messages from memory.