Skip to content

Commit 6bf7206

Browse files
committed
change default configuration for chat history.
1 parent f887cff commit 6bf7206

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Chinese.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -643,12 +643,12 @@ You are a friendly chatbot. The following is a summary of parts of your chat his
643643
以下是聊天历史的配置,同时给出了每个配置的默认值(这些默认值以后可能会修改):
644644

645645
```
646-
{"summary_cnt": 0, "summary_ctx_cnt": 1, "summary_prompt" : "Give a concise and comprehensive summary of the given conversation (in JSON format). The summary should capture the main points and supporting details.\nConversation: \"\"\"\n{{conversation}}\n\"\"\"\nSummary:", "msg_ctx_cnt": 10}
646+
{"summary_cnt": 20, "summary_ctx_cnt": 1, "summary_prompt" : "Give a concise and comprehensive summary of the given conversation (in JSON format). The summary should capture the main points and supporting details.\nConversation: \"\"\"\n{{conversation}}\n\"\"\"\nSummary:", "msg_ctx_cnt": 10}
647647
```
648648

649649
Chat application会对你最近的*summary_cnt*条消息进行总结,并将总结写入到vector store中。当你发送一条消息时,它会从vector store中检索*summary_ctx_cnt*条最相关的总结作为你和LLM模型聊天的历史记录。然后chat应用会将这个聊天历史(长期记忆)和最近的*msg_ctx_cnt*条消息(短期记忆)作为你们聊天上下文,结合当前的消息一起发送给LLM模型。通过这种方式LLM模型就能“记住”你们的聊天历史了。
650650

651-
如果*summary_cnt*使用默认值,0,那么chat应用不会对你的聊天历史进行总结,也不会使用该总结作为聊天上下文。
651+
如果*summary_cnt*设置为0,那么chat应用不会对你的聊天历史进行总结,也不会使用该总结作为聊天上下文。一次对话中,使用越多的历史总结,越多的最近消息记录,聊天的体验会越好(LLM可能知道越多的聊天上下文),但token开销也会越大
652652

653653
#### 返回值
654654

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,12 @@ You are a friendly chatbot. The following is a summary of parts of your chat his
645645
The following is the history configuration and related default values (these default values might be changed in the future):
646646

647647
```
648-
{"summary_cnt": 0, "summary_ctx_cnt": 1, "summary_prompt" : "Give a concise and comprehensive summary of the given conversation (in JSON format). The summary should capture the main points and supporting details.\nConversation: \"\"\"\n{{conversation}}\n\"\"\"\nSummary:", "msg_ctx_cnt": 10}
648+
{"summary_cnt": 20, "summary_ctx_cnt": 1, "summary_prompt" : "Give a concise and comprehensive summary of the given conversation (in JSON format). The summary should capture the main points and supporting details.\nConversation: \"\"\"\n{{conversation}}\n\"\"\"\nSummary:", "msg_ctx_cnt": 10}
649649
```
650650

651651
Chat application summarize your latest *summary_cnt* messages, and store it into the vector store. When you send a message, it searches *summary_ctx_cnt* nearest summaries from the vector store as your conversation history. Finally, it uses both the conversation history (long term) and latest *msg_ctx_cnt* messages (short term) as context, and send your input message to LLM for completion. In this way, LLM can "remember" your conversation history.
652652

653-
If *summary_cnt* is 0, i.e. the default value, chat application does not summarize your conversation, and does not use long term history as context.
653+
If *summary_cnt* is 0, chat application does not summarize your conversation, and does not use long term history as context. The more history summaries, the more latest messages, the better conversation experience (LLM knows more conversation context), but the more cost.
654654

655655
#### Return
656656

src/sw/redis-llm/chat_history.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ struct ChatHistoryOptions {
3535

3636
explicit ChatHistoryOptions(const nlohmann::json &conf);
3737

38-
// Summarize last n messages. 0 means do not enable summary.
39-
uint32_t summary_cnt = 0;
38+
// Summarize every n messages. 0 means do not enable summary.
39+
uint32_t summary_cnt = 20;
4040

4141
// Use the nearest n summaries as context.
4242
uint32_t summary_ctx_cnt = 1;
@@ -48,7 +48,7 @@ Conversation: """
4848
Summary: )";
4949

5050
// Use latest n messages as context.
51-
uint32_t msg_ctx_cnt = 5;
51+
uint32_t msg_ctx_cnt = 10;
5252

5353
std::string ai_role = "assistant";
5454

0 commit comments

Comments
 (0)