Retrieve
labridge.func_modules.memory.chat.retrieve
¶
labridge.func_modules.memory.chat.retrieve.ChatMemoryRetriever
¶
Bases: LogBaseRetriever
This is a retriever that retrieve in the permanent chat history of a user or a chat group. You can use this tool when you want to obtain the historical interaction between you and the user.
PARAMETER | DESCRIPTION |
---|---|
embed_model |
The used embedding model, if not specified, will use the
TYPE:
|
final_use_context |
Whether to add the context nodes of the retrieved log nodes to the final results. Defaults to True.
TYPE:
|
relevant_top_k |
The top-k relevant nodes in retrieving will be used as the retrieved results.
Defaults to
TYPE:
|
Source code in labridge\func_modules\memory\chat\retrieve.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
labridge.func_modules.memory.chat.retrieve.ChatMemoryRetriever.aretrieve(item_to_be_retrieved, memory_id, start_date=None, end_date=None, **kwargs)
async
¶
This method is used to asynchronously retrieve relevant chat history in a certain chat history memory.
The memory_id of a chat history memory is the user_id
of a specific user or the chat_group_id
of a specific
chat group.
Additionally, you can provide the start_date
and end_state
to limit the retrieving range of date,
The end date should not be earlier than the start date.
If the start date or end_date is not provided, retrieving will be performed among the whole memory.
PARAMETER | DESCRIPTION |
---|---|
item_to_be_retrieved |
Things that you want to retrieve in the chat history memory.
TYPE:
|
memory_id |
The memory_id of a chat history memory. It is either a
TYPE:
|
start_date |
The START date of the retrieving date limit. Defaults to None. If given, it should be given in the following FORMAT: Year-Month-Day. For example, 2020-12-1 means the year 2020, the 12th month, the 1rst day.
TYPE:
|
end_date |
The END date of the retrieving date limit. Defaults to None. If given, it should be given in the following FORMAT: Year-Month-Day. For example, 2024-6-2 means the year 2024, the 6th month, the 2nd day.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[NodeWithScore]
|
Retrieved chat history. |
Source code in labridge\func_modules\memory\chat\retrieve.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
labridge.func_modules.memory.chat.retrieve.ChatMemoryRetriever.retrieve(item_to_be_retrieved, memory_id, start_date=None, end_date=None, **kwargs)
¶
This tool is used to retrieve relevant chat history in a certain chat history memory.
The memory_id of a chat history memory is the user_id
of a specific user or the chat_group_id
of a specific
chat group.
Additionally, you can provide the start_date
and end_state
to limit the retrieving range of date,
The end date can be the same as the start date, but should not be earlier than the start date.
If the start date or end_date is not provided, retrieving will be performed among the whole memory.
PARAMETER | DESCRIPTION |
---|---|
item_to_be_retrieved |
Things that you want to retrieve in the chat history memory.
TYPE:
|
memory_id |
The memory_id of a chat history memory. It is either a
TYPE:
|
start_date |
The START date of the retrieving date limit. Defaults to None. If given, it should be given in the following FORMAT: Year-Month-Day. For example, 2020-12-1 means the year 2020, the 12th month, the 1rst day.
TYPE:
|
end_date |
The END date of the retrieving date limit. Defaults to None. If given, It should be given in the following FORMAT: Year-Month-Day. For example, 2024-6-2 means the year 2024, the 6th month, the 2nd day.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[NodeWithScore]
|
Retrieved chat history. |
Source code in labridge\func_modules\memory\chat\retrieve.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|