Tiancheng: small change

This commit is contained in:
承玙 2024-08-05 19:16:02 +08:00
parent e64adc57cb
commit 19bab4f600
4 changed files with 81 additions and 42 deletions

View file

@ -52,16 +52,14 @@ accurate relevant information when the query involves reference to time.
### Example Usages
- [Simple Usages](./examples/api/simple_usages_en.ipynb)
- [Simple Usages (Quick Start)](./examples/api/simple_usages_en.ipynb)
- [CLI with a MemoryScope Chatbot](./examples/cli/dash_cli_cn1.sh)
- [Advanced Customization](./examples/api/advanced_customization_en.ipynb)
## 🚀 Installation
### Quick Start (CLI)
Todo: Jingli add CLI here
### (1) Docker-Compose (Recommended)
1. Clone the project and edit the config.

View file

@ -42,14 +42,12 @@ MemoryScope 是一个为LLM聊天机器人服务的强大且灵活的长期记
- T系统在执行记忆检索和记忆巩固时具备时间敏感性,因此在输入对话包含对时间的指涉时,可以检索到准确的相关信息。
### 用法示例
- [简易用法](./examples/api/simple_usages_cn.ipynb)
- [简易用法(快速开始)](./examples/api/simple_usages_cn.ipynb)
- [在命令行与MemoryScope聊天机器人交互](./examples/cli/dash_cli_cn1.sh)
- [进阶自定义用法](./examples/api/advanced_customization_cn.ipynb)
## 🚀 安装
### 快速开始 (CLI)
Todo: Jingli add CLI here
## 💡 代码贡献
欢迎社区的代码贡献。

View file

@ -4,9 +4,9 @@
"cell_type": "markdown",
"source": [
"# chat 和 service 接口的示例用法\n",
"这个笔记本展示了 MemoryScope 的 chat 和 service 接口的简单用法,以及它的主要功能。\n",
"这个笔记本展示了 MemoryScope 的 **chat** 和 **service** 接口的简单用法,以及它的主要功能。\n",
"\n",
"在运行这个笔记本之前,请先按照 Readme 中的 Installation 指南进行安装,并启动 Docker 镜像。\n"
"在运行这个笔记本之前,请先按照 Readme 中的 **Installation** 指南进行安装,并启动 Docker 镜像。\n"
],
"metadata": {
"collapsed": false
@ -455,6 +455,31 @@
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 0,
"outputs": [],
"source": [
"import time\n",
"\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"你知道我的乐器爱好是什么吗?\",\n",
" history_message_strategy=None)\n",
"end_time = time.time()\n",
"total_time = end_time - start_time\n",
"print(\"使用记忆检索\\n回答20:\\n\" + response.message.content + f\"\\n 耗时:{total_time}秒\\n\")\n",
"\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"你知道我接下去的一个月内有什么计划吗?\",\n",
" history_message_strategy=None)\n",
"end_time = time.time()\n",
"total_time = end_time - start_time\n",
"print(\"使用记忆检索\\n回答21:\\n\" + response.message.content + f\"\\n 耗时:{total_time}秒\\n\")"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 11,
@ -489,22 +514,6 @@
}
],
"source": [
"import time\n",
"\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"你知道我的乐器爱好是什么吗?\",\n",
" history_message_strategy=None)\n",
"end_time = time.time()\n",
"total_time = end_time - start_time\n",
"print(\"使用记忆检索\\n回答20:\\n\" + response.message.content + f\"\\n 耗时:{total_time}秒\\n\")\n",
"\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"你知道我接下去的一个月内有什么计划吗?\",\n",
" history_message_strategy=None)\n",
"end_time = time.time()\n",
"total_time = end_time - start_time\n",
"print(\"使用记忆检索\\n回答21:\\n\" + response.message.content + f\"\\n 耗时:{total_time}秒\\n\")\n",
"\n",
"memory_chat.run_service_operation(\"delete_all\")\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"你知道我的乐器爱好是什么吗?\",\n",
@ -538,6 +547,18 @@
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"## 更多用法\n",
"我们建议读者参考[进阶自定义用法](./examples/api/advanced_customization_cn.ipynb)来对MemoryScope系统进行各种自定义设置。您还可以通过自定义**workflow**和对应的**worker**来创建或定制满足您特定需求的**operation**。\n",
"\n",
"此外,您还可以尝试使用[在命令行与MemoryScope聊天机器人交互](./examples/cli/dash_cli_cn1.sh)。我们在这里实现了始终在后台异步运行**记忆巩固**和**反思与再巩固**这两个操作,从而使得它们不会增加聊天的响应时间。"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,

View file

@ -471,6 +471,31 @@
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 0,
"outputs": [],
"source": [
"import time\n",
"\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"Do you know if I play any musical instruments?\",\n",
" history_message_strategy=None)\n",
"end_time = time.time()\n",
"total_time = end_time - start_time\n",
"print(\"With memory retrieval\\nResponse 20: \\n\" + response.message.content + f\"\\n RT: {total_time} seconds\\n\")\n",
"\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"Do you know if I have any plans in the next month?\",\n",
" history_message_strategy=None)\n",
"end_time = time.time()\n",
"total_time = end_time - start_time\n",
"print(\"With memory retrieval\\nResponse 21: \\n\" + response.message.content + f\"\\n RT: {total_time} seconds\\n\")"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": 11,
@ -507,22 +532,6 @@
}
],
"source": [
"import time\n",
"\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"Do you know if I play any musical instruments?\",\n",
" history_message_strategy=None)\n",
"end_time = time.time()\n",
"total_time = end_time - start_time\n",
"print(\"With memory retrieval\\nResponse 20: \\n\" + response.message.content + f\"\\n RT: {total_time} seconds\\n\")\n",
"\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"Do you know if I have any plans in the next month?\",\n",
" history_message_strategy=None)\n",
"end_time = time.time()\n",
"total_time = end_time - start_time\n",
"print(\"With memory retrieval\\nResponse 21: \\n\" + response.message.content + f\"\\n RT: {total_time} seconds\\n\")\n",
"\n",
"memory_chat.run_service_operation(\"delete_all\")\n",
"start_time = time.time()\n",
"response = memory_chat.chat_with_memory(query=\"Do you know if I play any musical instruments?\",\n",
@ -556,6 +565,19 @@
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"## More Examples\n",
"We direct the reader to [Advanced Customization](./examples/api/advanced_customization_en.ipynb) for guidance on customizing the various settings of the MemoryScope system. It is also possible to create or customize your own MemoryScope **operations** by specifying a **workflow** and the corresponding **workers** that best meet your specific needs.\n",
"\n",
"Additionally, you can also try out the [CLI with a MemoryScope Chatbot](./examples/cli/dash_cli_cn1.sh). We have implemented the chatbot so that the **Memory Consolidation** and **Reflection and Re-Consolidation** operations are always run asynchronously in the backend, ensuring that they do not incur any response time for the user.\n",
"\n"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,