Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/memos/memories/textual/tree_text_memory/retrieve/searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ def search(
f"[TIMER] Graph embedding search took {(time.perf_counter() - search_start) * 1000:.2f} ms"
)

# add some knowledge retrieved from internet to the context to avoid misunderstanding while parsing the task goal.
if self.internet_retriever:
supplyment_memory_items = self.internet_retriever.retrieve_from_internet(
query=query, top_k=3
)
context.extend(
[
each_supplyment_item.memory.partition("\nContent: ")[-1]
for each_supplyment_item in supplyment_memory_items
]
)

# Step 1a: Parse task structure into topic, concept, and fact levels
parse_start = time.perf_counter()
parsed_goal = self.task_goal_parser.parse(
task_description=query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
2. Tags: thematic tags to help categorize and retrieve related memories.
3. Goal Type: retrieval | qa | generation
4. Rephrased instruction: Give a rephrased task instruction based on the former conversation to make it less confusing to look alone. If you think the task instruction is easy enough to understand, or there is no former conversation, set "rephrased_instruction" to an empty string.
5. Need for internet search: If you think you need to search the internet to finish the rephrased/original user task instruction, set "internet_search" to True. Otherwise, set it to False.
5. Need for internet search: If the user's task instruction only involves objective facts or can be completed without introducing external knowledge, set "internet_search" to False. Otherwise, set it to True.
6. Memories: Provide 2–5 short semantic expansions or rephrasings of the rephrased/original user task instruction. These are used for improved embedding search coverage. Each should be clear, concise, and meaningful for retrieval.

Task description:
Expand Down
2 changes: 1 addition & 1 deletion src/memos/templates/mos_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
- `memoriesID` is the specific memory ID from the available memories list

### Reference Examples
- Correct: `[1:abc123]`, `[2:def456]`, `[3:ghi789]`, `[4:jkl101]`, `[5:mno112]`
- Correct: `[1:abc123]`, `[2:def456]`, `[3:ghi789]`, `[4:jkl101][5:mno112]` (concatenate reference annotation directly while citing multiple memories)
- Incorrect: `[1:abc123,2:def456]` (do not use connected format)

## Response Guidelines
Expand Down