[{"data":1,"prerenderedAt":2388},["ShallowReactive",2],{"\u002Fmemos_cloud\u002Fmem_operations\u002Fsearch_memory":3,"surround-\u002Fmemos_cloud\u002Fmem_operations\u002Fsearch_memory":2373},{"id":4,"title":5,"avatar":6,"banner":6,"body":7,"category":6,"desc":2366,"description":161,"extension":2367,"links":6,"meta":2368,"navigation":6,"path":2369,"seo":2370,"stem":2371,"__hash__":2372},"docs\u002Fen\u002Fmemos_cloud\u002Fmem_operations\u002Fsearch_memory.md","Search Memory",null,{"type":8,"value":9,"toc":2353},"minimark",[10,34,36,41,44,66,68,72,92,94,98,137,145,147,151,866,874,876,880,892,900,902,906,911,916,927,1544,1546,1550,1553,1558,2077,2086,2088,2092,2109,2119,2207,2213,2215,2219,2227,2349],[11,12,13,29],"warning",{},[14,15,16,24,27],"p",{},[17,18,19],"strong",{},[20,21,23],"a",{"href":22},"\u002Fapi_docs\u002Fcore\u002Fsearch_memory","Click here to view the API documentation directly",[25,26],"br",{},[25,28],{},[14,30,31],{},[17,32,33],{},"This article focuses on functionality instructions. For detailed interface fields and restrictions, please click the link above.",[25,35],{},[37,38,40],"h2",{"id":39},"_1-what-is-memory-retrieval","1. What is Memory Retrieval?",[14,42,43],{},"Memory retrieval refers to how MemOS, upon receiving a user's query, returns the most relevant and critical memory content from the memory database, combined with developer-defined filtering conditions. When generating answers, the model refers to these recalled memories to provide more accurate, relevant, and context-aware responses.",[45,46,47,52],"note",{},[14,48,49],{},[17,50,51],{}," Why is memory retrieval needed?",[53,54,56],"div",{"style":55},"padding-left: 2em;",[57,58,59,63],"ul",{},[60,61,62],"li",{},"No need to build context from scratch; directly access correct and reliable memories.",[60,64,65],{},"Use filters and other methods to ensure that recalled memories are always highly relevant to the current question.",[25,67],{},[37,69,71],{"id":70},"_2-key-parameters","2. Key Parameters",[57,73,74,80,86],{},[60,75,76,79],{},[17,77,78],{},"Query Content (query)",": The user's question or statement, expressed in natural language, used to retrieve relevant memories through semantic matching.",[60,81,82,85],{},[17,83,84],{},"Memory Filter (filter)",": Logic conditions in JSON format to filter on agent, create_time, tags, info, and other fields, narrowing the scope of memory retrieval. For example, retrieve only \"memories from the last 30 days\".",[60,87,88,91],{},[17,89,90],{},"Relevance Threshold (relativity)",": Relevance refers to the semantic similarity between retrieved memories and the user's query; the higher the relevance score, the more closely the memory matches the current question. The relevance threshold controls the minimum matching level for retrieval. Default is 0.45, and memories below this value will be filtered out.",[25,93],{},[37,95,97],{"id":96},"_3-how-it-works","3. How It Works",[57,99,100,106,131],{},[60,101,102,105],{},[17,103,104],{},"Query Rewriting",": MemOS cleans and semantically enhances the user’s natural language query, automatically supplementing key information and retrieval intent for improved accuracy.",[60,107,108,111],{},[17,109,110],{},"Memory Recall",[57,112,113,119,125],{},[60,114,115,118],{},[17,116,117],{},"Hybrid Retrieval and Ranking",": The system generates embedding vectors based on the rewritten query and uses a hybrid of keyword and vector semantic retrieval strategies to recall candidate memories that are then ranked uniformly.",[60,120,121,124],{},[17,122,123],{},"Memory Filtering and Selection",": Logical conditions and comparison operators are used to filter memories structurally, narrowing the retrieval range. Only the memories over the developer-set relevance threshold are kept to ensure quality results.",[60,126,127,130],{},[17,128,129],{},"Deduplication",": Cross-source deduplication and semantic aggregation are conducted on the recalled candidate memories.",[60,132,133,136],{},[17,134,135],{},"Output Memories",": The final results are returned up to the set number of memory items, with a response time within 600ms, supporting subsequent reasoning and answer generation.",[14,138,139,140,144],{},"All these processes are triggered with a single call to the ",[141,142,143],"code",{},"search\u002Fmemory"," endpoint—no manual memory operations are required.",[25,146],{},[37,148,150],{"id":149},"_4-quick-start","4. Quick Start",[152,153,154,588],"code-group",{},[155,156,162],"pre",{"className":157,"code":158,"filename":159,"language":160,"meta":161,"style":161},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import os\nimport requests\nimport json\n\n# Replace with your MemOS API Key\nos.environ[\"MEMOS_API_KEY\"] = \"YOUR_API_KEY\"\nos.environ[\"MEMOS_BASE_URL\"] = \"https:\u002F\u002Fmemos.memtensor.cn\u002Fapi\u002Fopenmem\u002Fv1\"\n\ndata = {\n  \"query\": \"I want to go out for National Day. Please recommend me a city I haven't been to and a hotel brand I haven't stayed at.\",\n  \"user_id\": \"memos_user_123\",\n  \"conversation_id\": \"0928\" # The current conversation ID (optional). If provided, MemOS gives higher weight to this conversation's memories but won't force a hit.\n}\nheaders = {\n  \"Content-Type\": \"application\u002Fjson\",\n  \"Authorization\": f\"Token {os.environ['MEMOS_API_KEY']}\"\n}\nurl = f\"{os.environ['MEMOS_BASE_URL']}\u002Fsearch\u002Fmemory\"\n\nres = requests.post(url=url, headers=headers, data=json.dumps(data))\n\nprint(f\"result: {res.json()}\")\n","Python (HTTP)","python","",[141,163,164,177,185,193,200,207,248,277,282,294,318,339,361,367,377,398,443,448,483,488,550,555],{"__ignoreMap":161},[165,166,169,173],"span",{"class":167,"line":168},"line",1,[165,170,172],{"class":171},"s7zQu","import",[165,174,176],{"class":175},"sTEyZ"," os\n",[165,178,180,182],{"class":167,"line":179},2,[165,181,172],{"class":171},[165,183,184],{"class":175}," requests\n",[165,186,188,190],{"class":167,"line":187},3,[165,189,172],{"class":171},[165,191,192],{"class":175}," json\n",[165,194,196],{"class":167,"line":195},4,[165,197,199],{"emptyLinePlaceholder":198},true,"\n",[165,201,203],{"class":167,"line":202},5,[165,204,206],{"class":205},"sHwdD","# Replace with your MemOS API Key\n",[165,208,210,213,217,221,224,227,231,233,236,239,242,245],{"class":167,"line":209},6,[165,211,212],{"class":175},"os",[165,214,216],{"class":215},"sMK4o",".",[165,218,220],{"class":219},"swJcz","environ",[165,222,223],{"class":215},"[",[165,225,226],{"class":215},"\"",[165,228,230],{"class":229},"sfazB","MEMOS_API_KEY",[165,232,226],{"class":215},[165,234,235],{"class":215},"]",[165,237,238],{"class":215}," =",[165,240,241],{"class":215}," \"",[165,243,244],{"class":229},"YOUR_API_KEY",[165,246,247],{"class":215},"\"\n",[165,249,251,253,255,257,259,261,264,266,268,270,272,275],{"class":167,"line":250},7,[165,252,212],{"class":175},[165,254,216],{"class":215},[165,256,220],{"class":219},[165,258,223],{"class":215},[165,260,226],{"class":215},[165,262,263],{"class":229},"MEMOS_BASE_URL",[165,265,226],{"class":215},[165,267,235],{"class":215},[165,269,238],{"class":215},[165,271,241],{"class":215},[165,273,274],{"class":229},"https:\u002F\u002Fmemos.memtensor.cn\u002Fapi\u002Fopenmem\u002Fv1",[165,276,247],{"class":215},[165,278,280],{"class":167,"line":279},8,[165,281,199],{"emptyLinePlaceholder":198},[165,283,285,288,291],{"class":167,"line":284},9,[165,286,287],{"class":175},"data ",[165,289,290],{"class":215},"=",[165,292,293],{"class":215}," {\n",[165,295,297,300,303,305,308,310,313,315],{"class":167,"line":296},10,[165,298,299],{"class":215},"  \"",[165,301,302],{"class":229},"query",[165,304,226],{"class":215},[165,306,307],{"class":215},":",[165,309,241],{"class":215},[165,311,312],{"class":229},"I want to go out for National Day. Please recommend me a city I haven't been to and a hotel brand I haven't stayed at.",[165,314,226],{"class":215},[165,316,317],{"class":215},",\n",[165,319,321,323,326,328,330,332,335,337],{"class":167,"line":320},11,[165,322,299],{"class":215},[165,324,325],{"class":229},"user_id",[165,327,226],{"class":215},[165,329,307],{"class":215},[165,331,241],{"class":215},[165,333,334],{"class":229},"memos_user_123",[165,336,226],{"class":215},[165,338,317],{"class":215},[165,340,342,344,347,349,351,353,356,358],{"class":167,"line":341},12,[165,343,299],{"class":215},[165,345,346],{"class":229},"conversation_id",[165,348,226],{"class":215},[165,350,307],{"class":215},[165,352,241],{"class":215},[165,354,355],{"class":229},"0928",[165,357,226],{"class":215},[165,359,360],{"class":205}," # The current conversation ID (optional). If provided, MemOS gives higher weight to this conversation's memories but won't force a hit.\n",[165,362,364],{"class":167,"line":363},13,[165,365,366],{"class":215},"}\n",[165,368,370,373,375],{"class":167,"line":369},14,[165,371,372],{"class":175},"headers ",[165,374,290],{"class":215},[165,376,293],{"class":215},[165,378,380,382,385,387,389,391,394,396],{"class":167,"line":379},15,[165,381,299],{"class":215},[165,383,384],{"class":229},"Content-Type",[165,386,226],{"class":215},[165,388,307],{"class":215},[165,390,241],{"class":215},[165,392,393],{"class":229},"application\u002Fjson",[165,395,226],{"class":215},[165,397,317],{"class":215},[165,399,401,403,406,408,410,414,417,421,423,425,427,429,432,434,436,438,441],{"class":167,"line":400},16,[165,402,299],{"class":215},[165,404,405],{"class":229},"Authorization",[165,407,226],{"class":215},[165,409,307],{"class":215},[165,411,413],{"class":412},"spNyl"," f",[165,415,416],{"class":229},"\"Token ",[165,418,420],{"class":419},"sbssI","{",[165,422,212],{"class":175},[165,424,216],{"class":215},[165,426,220],{"class":219},[165,428,223],{"class":215},[165,430,431],{"class":215},"'",[165,433,230],{"class":229},[165,435,431],{"class":215},[165,437,235],{"class":215},[165,439,440],{"class":419},"}",[165,442,247],{"class":229},[165,444,446],{"class":167,"line":445},17,[165,447,366],{"class":215},[165,449,451,454,456,458,460,462,464,466,468,470,472,474,476,478,480],{"class":167,"line":450},18,[165,452,453],{"class":175},"url ",[165,455,290],{"class":215},[165,457,413],{"class":412},[165,459,226],{"class":229},[165,461,420],{"class":419},[165,463,212],{"class":175},[165,465,216],{"class":215},[165,467,220],{"class":219},[165,469,223],{"class":215},[165,471,431],{"class":215},[165,473,263],{"class":229},[165,475,431],{"class":215},[165,477,235],{"class":215},[165,479,440],{"class":419},[165,481,482],{"class":229},"\u002Fsearch\u002Fmemory\"\n",[165,484,486],{"class":167,"line":485},19,[165,487,199],{"emptyLinePlaceholder":198},[165,489,491,494,496,499,501,505,508,512,514,516,519,522,524,527,529,532,534,537,539,542,544,547],{"class":167,"line":490},20,[165,492,493],{"class":175},"res ",[165,495,290],{"class":215},[165,497,498],{"class":175}," requests",[165,500,216],{"class":215},[165,502,504],{"class":503},"s2Zo4","post",[165,506,507],{"class":215},"(",[165,509,511],{"class":510},"sHdIc","url",[165,513,290],{"class":215},[165,515,511],{"class":503},[165,517,518],{"class":215},",",[165,520,521],{"class":510}," headers",[165,523,290],{"class":215},[165,525,526],{"class":503},"headers",[165,528,518],{"class":215},[165,530,531],{"class":510}," data",[165,533,290],{"class":215},[165,535,536],{"class":503},"json",[165,538,216],{"class":215},[165,540,541],{"class":503},"dumps",[165,543,507],{"class":215},[165,545,546],{"class":503},"data",[165,548,549],{"class":215},"))\n",[165,551,553],{"class":167,"line":552},21,[165,554,199],{"emptyLinePlaceholder":198},[165,556,558,561,563,566,569,571,574,576,578,581,583,585],{"class":167,"line":557},22,[165,559,560],{"class":503},"print",[165,562,507],{"class":215},[165,564,565],{"class":412},"f",[165,567,568],{"class":229},"\"result: ",[165,570,420],{"class":419},[165,572,573],{"class":503},"res",[165,575,216],{"class":215},[165,577,536],{"class":503},[165,579,580],{"class":215},"()",[165,582,440],{"class":419},[165,584,226],{"class":229},[165,586,587],{"class":215},")\n",[155,589,592],{"className":157,"code":590,"filename":591,"language":160,"meta":161,"style":161},"# Example output (simplified for demonstration purposes)\n{\n  # Fact memories\n  memory_detail_list [\n    {\n      \"memory_key\": \"Summer Vacation Guangzhou Travel Plan\",\n      \"memory_value\": \"The user plans to travel to Guangzhou during the summer vacation and has chosen 7 Days Inn as their accommodation.\",\n      \"conversation_id\": \"0610\",\n      \"tags\": [\n        \"travel\",\n        \"Guangzhou\",\n        \"accommodation\",\n        \"hotel\"\n      ]\n    }\n  ],\n  # Preference memories\n  preference_detail_list [\n    {\n      \"preference_type\": \"implicit_preference\",  # Implicit preference\n      \"preference\": \"The user may prefer cost-effective hotel choices.\",\n      \"reasoning\": \"7 Days Inn is generally known for being affordable; the user's choice indicates a preference for good value. Although the user hasn't explicitly mentioned budget or hotel preferences, selecting 7 Days may reflect a focus on price and practicality.\",\n      \"conversation_id\": \"0610\"\n    }\n  ]\n}\n","Output",[141,593,594,599,604,609,617,622,643,663,682,696,708,719,730,739,744,749,754,759,766,770,793,813,833,850,855,861],{"__ignoreMap":161},[165,595,596],{"class":167,"line":168},[165,597,598],{"class":205},"# Example output (simplified for demonstration purposes)\n",[165,600,601],{"class":167,"line":179},[165,602,603],{"class":215},"{\n",[165,605,606],{"class":167,"line":187},[165,607,608],{"class":205},"  # Fact memories\n",[165,610,611,614],{"class":167,"line":195},[165,612,613],{"class":175},"  memory_detail_list ",[165,615,616],{"class":215},"[\n",[165,618,619],{"class":167,"line":202},[165,620,621],{"class":215},"    {\n",[165,623,624,627,630,632,634,636,639,641],{"class":167,"line":209},[165,625,626],{"class":215},"      \"",[165,628,629],{"class":229},"memory_key",[165,631,226],{"class":215},[165,633,307],{"class":215},[165,635,241],{"class":215},[165,637,638],{"class":229},"Summer Vacation Guangzhou Travel Plan",[165,640,226],{"class":215},[165,642,317],{"class":215},[165,644,645,647,650,652,654,656,659,661],{"class":167,"line":250},[165,646,626],{"class":215},[165,648,649],{"class":229},"memory_value",[165,651,226],{"class":215},[165,653,307],{"class":215},[165,655,241],{"class":215},[165,657,658],{"class":229},"The user plans to travel to Guangzhou during the summer vacation and has chosen 7 Days Inn as their accommodation.",[165,660,226],{"class":215},[165,662,317],{"class":215},[165,664,665,667,669,671,673,675,678,680],{"class":167,"line":279},[165,666,626],{"class":215},[165,668,346],{"class":229},[165,670,226],{"class":215},[165,672,307],{"class":215},[165,674,241],{"class":215},[165,676,677],{"class":229},"0610",[165,679,226],{"class":215},[165,681,317],{"class":215},[165,683,684,686,689,691,693],{"class":167,"line":284},[165,685,626],{"class":215},[165,687,688],{"class":229},"tags",[165,690,226],{"class":215},[165,692,307],{"class":215},[165,694,695],{"class":215}," [\n",[165,697,698,701,704,706],{"class":167,"line":296},[165,699,700],{"class":215},"        \"",[165,702,703],{"class":229},"travel",[165,705,226],{"class":215},[165,707,317],{"class":215},[165,709,710,712,715,717],{"class":167,"line":320},[165,711,700],{"class":215},[165,713,714],{"class":229},"Guangzhou",[165,716,226],{"class":215},[165,718,317],{"class":215},[165,720,721,723,726,728],{"class":167,"line":341},[165,722,700],{"class":215},[165,724,725],{"class":229},"accommodation",[165,727,226],{"class":215},[165,729,317],{"class":215},[165,731,732,734,737],{"class":167,"line":363},[165,733,700],{"class":215},[165,735,736],{"class":229},"hotel",[165,738,247],{"class":215},[165,740,741],{"class":167,"line":369},[165,742,743],{"class":215},"      ]\n",[165,745,746],{"class":167,"line":379},[165,747,748],{"class":215},"    }\n",[165,750,751],{"class":167,"line":400},[165,752,753],{"class":215},"  ],\n",[165,755,756],{"class":167,"line":445},[165,757,758],{"class":205},"  # Preference memories\n",[165,760,761,764],{"class":167,"line":450},[165,762,763],{"class":175},"  preference_detail_list ",[165,765,616],{"class":215},[165,767,768],{"class":167,"line":485},[165,769,621],{"class":215},[165,771,772,774,777,779,781,783,786,788,790],{"class":167,"line":490},[165,773,626],{"class":215},[165,775,776],{"class":229},"preference_type",[165,778,226],{"class":215},[165,780,307],{"class":215},[165,782,241],{"class":215},[165,784,785],{"class":229},"implicit_preference",[165,787,226],{"class":215},[165,789,518],{"class":215},[165,791,792],{"class":205},"  # Implicit preference\n",[165,794,795,797,800,802,804,806,809,811],{"class":167,"line":552},[165,796,626],{"class":215},[165,798,799],{"class":229},"preference",[165,801,226],{"class":215},[165,803,307],{"class":215},[165,805,241],{"class":215},[165,807,808],{"class":229},"The user may prefer cost-effective hotel choices.",[165,810,226],{"class":215},[165,812,317],{"class":215},[165,814,815,817,820,822,824,826,829,831],{"class":167,"line":557},[165,816,626],{"class":215},[165,818,819],{"class":229},"reasoning",[165,821,226],{"class":215},[165,823,307],{"class":215},[165,825,241],{"class":215},[165,827,828],{"class":229},"7 Days Inn is generally known for being affordable; the user's choice indicates a preference for good value. Although the user hasn't explicitly mentioned budget or hotel preferences, selecting 7 Days may reflect a focus on price and practicality.",[165,830,226],{"class":215},[165,832,317],{"class":215},[165,834,836,838,840,842,844,846,848],{"class":167,"line":835},23,[165,837,626],{"class":215},[165,839,346],{"class":229},[165,841,226],{"class":215},[165,843,307],{"class":215},[165,845,241],{"class":215},[165,847,677],{"class":229},[165,849,247],{"class":215},[165,851,853],{"class":167,"line":852},24,[165,854,748],{"class":215},[165,856,858],{"class":167,"line":857},25,[165,859,860],{"class":215},"  ]\n",[165,862,864],{"class":167,"line":863},26,[165,865,366],{"class":215},[45,867,868],{},[14,869,870,871,873],{}," Note: ",[141,872,325],{}," is required; each memory retrieval must specify a single user.",[25,875],{},[37,877,879],{"id":878},"_5-example-assembling-retrieved-memories-into-a-prompt","5. Example: Assembling Retrieved Memories into a Prompt",[45,881,882,889],{},[14,883,884,887],{},[17,885,886],{},"Memory Prompt Assembling",[25,888],{},[14,890,891],{},"Using retrieved memories effectively requires certain techniques; here’s an example.",[155,893,898],{"className":894,"code":896,"language":897,"meta":161},[895],"language-text","# Role\nYou are an intelligent assistant (MemOS Assistant) with long-term memory capabilities. Your goal is to use the recalled memory fragments to provide highly personalized, accurate, and logically sound answers for the user.\n\n# System Context\n- Current time: 2026-01-06 15:05 (use this as the basis for memory freshness judgment)\n\n# Memory Data\nBelow are the relevant facts and preferences retrieved by MemOS, divided into \"Facts\" and \"Preferences\".\n- **Facts**: May include user attributes, history, or third-party information.\n- **Caution**: Items tagged with '[assistant’s opinion]' or '[model summary]' indicate past AI inferences, **not** the user’s original words.\n- **Preferences**: Explicit or implicit requirements for answer style, format, or logic.\n\n\u003Cmemories>\n  \u003Cfacts>\n    -[2025-12-26 21:45] The user plans to travel to Guangzhou during the summer vacation and has chosen 7 Days Inn as their accommodation.\n    -[2025-12-26 14:26] The user's name is Grace.\n  \u003C\u002Ffacts>\n\n  \u003Cpreferences>\n    -[2026-01-04 20:41] [Explicit Preference] The user likes to travel to southern China.\n    -[2025-12-26 21:45] [Implicit Preference] The user may prefer cost-effective hotel options.\n  \u003C\u002Fpreferences>\n\u003C\u002Fmemories>\n\n# Critical Protocol: Memory Safety\nRetrieved memories may contain **AI speculation**, **irrelevant noise**, or **subject errors**. You must strictly execute the following **\"Four-Step Judgment\"**: if any step fails, **discard** that memory.\n\n1. **Source Verification**:\n   - **Core**: Distinguish between user’s original words and AI inference.\n   - If the memory is tagged with '[assistant’s opinion]', it is only an AI **assumption** and **must not** be treated as a user’s hard fact.\n   - *Counter-example*: '[assistant’s opinion] The user loves mangoes.' If the user never said it, do NOT assume so to prevent AI feedback loops.\n   - **Principle: AI summaries are for reference only and hold much lower weight than direct user statements.**\n\n2. **Attribution Check**:\n   - Is the memory’s subject really \"the user\"?\n   - If the memory describes a **third party** (e.g., \"candidate\", \"interviewee\", \"fictional character\", \"case data\"), NEVER attribute their qualities to the user.\n\n3. **Relevance Check**:\n   - Does the memory directly help answer the current 'Original Query'?\n   - If it’s just a keyword match but a totally different context, it MUST be ignored.\n\n4. **Freshness Check**:\n   - Does the memory conflict with the user's latest intent? The 'Original Query' always takes precedence.\n\n# Instructions\n1. **Examine**: Read '\u003Cfacts>' and execute the Four-Step Judgment, removing noisy or untrustworthy AI findings.\n2. **Execute**:\n   - Only use filtered memories as background.\n   - Strictly follow style requirements in '\u003Cpreferences>'.\n3. **Output**: Answer the question directly, and NEVER mention \"memory database\", \"retrieval\", \"AI opinion\", or other system-internal terms.\n\n# Original Query\nI want to go out for National Day. Please recommend me a city I haven't been to and a hotel brand I haven't stayed at.\n\n","text",[141,899,896],{"__ignoreMap":161},[25,901],{},[37,903,905],{"id":904},"_6-more-usage-methods","6. More Usage Methods",[907,908,910],"h3",{"id":909},"retrieve-overall-user-profile","Retrieve Overall User Profile",[14,912,913,914,216],{},"If you need user analysis for your application, or want to display \"key personal impressions\" to users in your AI app in real time, you can call MemOS to retrieve user's global memories to help LLMs build personalized profiles. No need to specify ",[141,915,346],{},[14,917,918,919,923,924,926],{},"As shown below, if you’ve tried ",[20,920,922],{"href":921},"\u002Fmemos_cloud\u002Fmem_operations\u002Fadd_message","adding a message"," before for ",[141,925,334],{},", you can copy this sample directly to retrieve user memories.",[152,928,929,1274],{},[155,930,932],{"className":157,"code":931,"filename":159,"language":160,"meta":161,"style":161},"import os\nimport json\nimport requests\n\nos.environ[\"MEMOS_API_KEY\"] = \"YOUR_API_KEY\"\nos.environ[\"MEMOS_BASE_URL\"] = \"https:\u002F\u002Fmemos.memtensor.cn\u002Fapi\u002Fopenmem\u002Fv1\"\n\n# Headers and base URL\nheaders = {\n  \"Authorization\": f\"Token {os.environ['MEMOS_API_KEY']}\",\n  \"Content-Type\": \"application\u002Fjson\"\n}\nBASE_URL = os.environ['MEMOS_BASE_URL']\n\n# Directly ask for a user profile, as query\nquery_text = \"What are my personal keywords?\"\n\ndata = {\n    \"user_id\": \"memos_user_123\",\n    \"query\": query_text,\n}\n\n# Call \u002Fsearch\u002Fmemory to retrieve relevant memories\nres = requests.post(f\"{BASE_URL}\u002Fsearch\u002Fmemory\", headers=headers, data=json.dumps(data))\n\nprint(f\"result: {res.json()}\")\n",[141,933,934,940,946,952,956,982,1008,1012,1017,1025,1063,1079,1083,1108,1112,1117,1131,1135,1143,1162,1177,1181,1185,1190,1244,1248],{"__ignoreMap":161},[165,935,936,938],{"class":167,"line":168},[165,937,172],{"class":171},[165,939,176],{"class":175},[165,941,942,944],{"class":167,"line":179},[165,943,172],{"class":171},[165,945,192],{"class":175},[165,947,948,950],{"class":167,"line":187},[165,949,172],{"class":171},[165,951,184],{"class":175},[165,953,954],{"class":167,"line":195},[165,955,199],{"emptyLinePlaceholder":198},[165,957,958,960,962,964,966,968,970,972,974,976,978,980],{"class":167,"line":202},[165,959,212],{"class":175},[165,961,216],{"class":215},[165,963,220],{"class":219},[165,965,223],{"class":215},[165,967,226],{"class":215},[165,969,230],{"class":229},[165,971,226],{"class":215},[165,973,235],{"class":215},[165,975,238],{"class":215},[165,977,241],{"class":215},[165,979,244],{"class":229},[165,981,247],{"class":215},[165,983,984,986,988,990,992,994,996,998,1000,1002,1004,1006],{"class":167,"line":209},[165,985,212],{"class":175},[165,987,216],{"class":215},[165,989,220],{"class":219},[165,991,223],{"class":215},[165,993,226],{"class":215},[165,995,263],{"class":229},[165,997,226],{"class":215},[165,999,235],{"class":215},[165,1001,238],{"class":215},[165,1003,241],{"class":215},[165,1005,274],{"class":229},[165,1007,247],{"class":215},[165,1009,1010],{"class":167,"line":250},[165,1011,199],{"emptyLinePlaceholder":198},[165,1013,1014],{"class":167,"line":279},[165,1015,1016],{"class":205},"# Headers and base URL\n",[165,1018,1019,1021,1023],{"class":167,"line":284},[165,1020,372],{"class":175},[165,1022,290],{"class":215},[165,1024,293],{"class":215},[165,1026,1027,1029,1031,1033,1035,1037,1039,1041,1043,1045,1047,1049,1051,1053,1055,1057,1059,1061],{"class":167,"line":296},[165,1028,299],{"class":215},[165,1030,405],{"class":229},[165,1032,226],{"class":215},[165,1034,307],{"class":215},[165,1036,413],{"class":412},[165,1038,416],{"class":229},[165,1040,420],{"class":419},[165,1042,212],{"class":175},[165,1044,216],{"class":215},[165,1046,220],{"class":219},[165,1048,223],{"class":215},[165,1050,431],{"class":215},[165,1052,230],{"class":229},[165,1054,431],{"class":215},[165,1056,235],{"class":215},[165,1058,440],{"class":419},[165,1060,226],{"class":229},[165,1062,317],{"class":215},[165,1064,1065,1067,1069,1071,1073,1075,1077],{"class":167,"line":320},[165,1066,299],{"class":215},[165,1068,384],{"class":229},[165,1070,226],{"class":215},[165,1072,307],{"class":215},[165,1074,241],{"class":215},[165,1076,393],{"class":229},[165,1078,247],{"class":215},[165,1080,1081],{"class":167,"line":341},[165,1082,366],{"class":215},[165,1084,1085,1088,1090,1093,1095,1097,1099,1101,1103,1105],{"class":167,"line":363},[165,1086,1087],{"class":175},"BASE_URL ",[165,1089,290],{"class":215},[165,1091,1092],{"class":175}," os",[165,1094,216],{"class":215},[165,1096,220],{"class":219},[165,1098,223],{"class":215},[165,1100,431],{"class":215},[165,1102,263],{"class":229},[165,1104,431],{"class":215},[165,1106,1107],{"class":215},"]\n",[165,1109,1110],{"class":167,"line":369},[165,1111,199],{"emptyLinePlaceholder":198},[165,1113,1114],{"class":167,"line":379},[165,1115,1116],{"class":205},"# Directly ask for a user profile, as query\n",[165,1118,1119,1122,1124,1126,1129],{"class":167,"line":400},[165,1120,1121],{"class":175},"query_text ",[165,1123,290],{"class":215},[165,1125,241],{"class":215},[165,1127,1128],{"class":229},"What are my personal keywords?",[165,1130,247],{"class":215},[165,1132,1133],{"class":167,"line":445},[165,1134,199],{"emptyLinePlaceholder":198},[165,1136,1137,1139,1141],{"class":167,"line":450},[165,1138,287],{"class":175},[165,1140,290],{"class":215},[165,1142,293],{"class":215},[165,1144,1145,1148,1150,1152,1154,1156,1158,1160],{"class":167,"line":485},[165,1146,1147],{"class":215},"    \"",[165,1149,325],{"class":229},[165,1151,226],{"class":215},[165,1153,307],{"class":215},[165,1155,241],{"class":215},[165,1157,334],{"class":229},[165,1159,226],{"class":215},[165,1161,317],{"class":215},[165,1163,1164,1166,1168,1170,1172,1175],{"class":167,"line":490},[165,1165,1147],{"class":215},[165,1167,302],{"class":229},[165,1169,226],{"class":215},[165,1171,307],{"class":215},[165,1173,1174],{"class":175}," query_text",[165,1176,317],{"class":215},[165,1178,1179],{"class":167,"line":552},[165,1180,366],{"class":215},[165,1182,1183],{"class":167,"line":557},[165,1184,199],{"emptyLinePlaceholder":198},[165,1186,1187],{"class":167,"line":835},[165,1188,1189],{"class":205},"# Call \u002Fsearch\u002Fmemory to retrieve relevant memories\n",[165,1191,1192,1194,1196,1198,1200,1202,1204,1206,1208,1210,1213,1215,1218,1220,1222,1224,1226,1228,1230,1232,1234,1236,1238,1240,1242],{"class":167,"line":852},[165,1193,493],{"class":175},[165,1195,290],{"class":215},[165,1197,498],{"class":175},[165,1199,216],{"class":215},[165,1201,504],{"class":503},[165,1203,507],{"class":215},[165,1205,565],{"class":412},[165,1207,226],{"class":229},[165,1209,420],{"class":419},[165,1211,1212],{"class":503},"BASE_URL",[165,1214,440],{"class":419},[165,1216,1217],{"class":229},"\u002Fsearch\u002Fmemory\"",[165,1219,518],{"class":215},[165,1221,521],{"class":510},[165,1223,290],{"class":215},[165,1225,526],{"class":503},[165,1227,518],{"class":215},[165,1229,531],{"class":510},[165,1231,290],{"class":215},[165,1233,536],{"class":503},[165,1235,216],{"class":215},[165,1237,541],{"class":503},[165,1239,507],{"class":215},[165,1241,546],{"class":503},[165,1243,549],{"class":215},[165,1245,1246],{"class":167,"line":857},[165,1247,199],{"emptyLinePlaceholder":198},[165,1249,1250,1252,1254,1256,1258,1260,1262,1264,1266,1268,1270,1272],{"class":167,"line":863},[165,1251,560],{"class":503},[165,1253,507],{"class":215},[165,1255,565],{"class":412},[165,1257,568],{"class":229},[165,1259,420],{"class":419},[165,1261,573],{"class":503},[165,1263,216],{"class":215},[165,1265,536],{"class":503},[165,1267,580],{"class":215},[165,1269,440],{"class":419},[165,1271,226],{"class":229},[165,1273,587],{"class":215},[155,1275,1277],{"className":157,"code":1276,"filename":591,"language":160,"meta":161,"style":161},"# Example output (simplified for demonstration purposes)\n\n{\n  # Fact memories\n  memory_detail_list [\n    {\n      \"memory_key\": \"AI-Assisted Requests\",\n      \"memory_value\": \"The user wants AI to help plan daily studies, recommend movies and books, and provide emotional companionship.\",\n      \"conversation_id\": \"0610\",\n      \"tags\": [\n        \"help\",\n        \"study plan\",\n        \"recommend\",\n        \"companionship\"\n      ]\n    },\n    {\n      \"memory_key\": \"Type of Help Wanted from AI\",\n      \"memory_value\": \"The user wants AI to provide advice, information lookup, and inspiration.\",\n      \"conversation_id\": \"0610\",\n      \"tags\": [\n        \"AI\",\n        \"help\",\n        \"type\"\n      ]\n    }\n  ]\n}\n",[141,1278,1279,1283,1287,1291,1295,1301,1305,1324,1343,1361,1373,1384,1395,1406,1415,1419,1424,1428,1447,1466,1484,1496,1507,1517,1526,1530,1534,1539],{"__ignoreMap":161},[165,1280,1281],{"class":167,"line":168},[165,1282,598],{"class":205},[165,1284,1285],{"class":167,"line":179},[165,1286,199],{"emptyLinePlaceholder":198},[165,1288,1289],{"class":167,"line":187},[165,1290,603],{"class":215},[165,1292,1293],{"class":167,"line":195},[165,1294,608],{"class":205},[165,1296,1297,1299],{"class":167,"line":202},[165,1298,613],{"class":175},[165,1300,616],{"class":215},[165,1302,1303],{"class":167,"line":209},[165,1304,621],{"class":215},[165,1306,1307,1309,1311,1313,1315,1317,1320,1322],{"class":167,"line":250},[165,1308,626],{"class":215},[165,1310,629],{"class":229},[165,1312,226],{"class":215},[165,1314,307],{"class":215},[165,1316,241],{"class":215},[165,1318,1319],{"class":229},"AI-Assisted Requests",[165,1321,226],{"class":215},[165,1323,317],{"class":215},[165,1325,1326,1328,1330,1332,1334,1336,1339,1341],{"class":167,"line":279},[165,1327,626],{"class":215},[165,1329,649],{"class":229},[165,1331,226],{"class":215},[165,1333,307],{"class":215},[165,1335,241],{"class":215},[165,1337,1338],{"class":229},"The user wants AI to help plan daily studies, recommend movies and books, and provide emotional companionship.",[165,1340,226],{"class":215},[165,1342,317],{"class":215},[165,1344,1345,1347,1349,1351,1353,1355,1357,1359],{"class":167,"line":284},[165,1346,626],{"class":215},[165,1348,346],{"class":229},[165,1350,226],{"class":215},[165,1352,307],{"class":215},[165,1354,241],{"class":215},[165,1356,677],{"class":229},[165,1358,226],{"class":215},[165,1360,317],{"class":215},[165,1362,1363,1365,1367,1369,1371],{"class":167,"line":296},[165,1364,626],{"class":215},[165,1366,688],{"class":229},[165,1368,226],{"class":215},[165,1370,307],{"class":215},[165,1372,695],{"class":215},[165,1374,1375,1377,1380,1382],{"class":167,"line":320},[165,1376,700],{"class":215},[165,1378,1379],{"class":229},"help",[165,1381,226],{"class":215},[165,1383,317],{"class":215},[165,1385,1386,1388,1391,1393],{"class":167,"line":341},[165,1387,700],{"class":215},[165,1389,1390],{"class":229},"study plan",[165,1392,226],{"class":215},[165,1394,317],{"class":215},[165,1396,1397,1399,1402,1404],{"class":167,"line":363},[165,1398,700],{"class":215},[165,1400,1401],{"class":229},"recommend",[165,1403,226],{"class":215},[165,1405,317],{"class":215},[165,1407,1408,1410,1413],{"class":167,"line":369},[165,1409,700],{"class":215},[165,1411,1412],{"class":229},"companionship",[165,1414,247],{"class":215},[165,1416,1417],{"class":167,"line":379},[165,1418,743],{"class":215},[165,1420,1421],{"class":167,"line":400},[165,1422,1423],{"class":215},"    },\n",[165,1425,1426],{"class":167,"line":445},[165,1427,621],{"class":215},[165,1429,1430,1432,1434,1436,1438,1440,1443,1445],{"class":167,"line":450},[165,1431,626],{"class":215},[165,1433,629],{"class":229},[165,1435,226],{"class":215},[165,1437,307],{"class":215},[165,1439,241],{"class":215},[165,1441,1442],{"class":229},"Type of Help Wanted from AI",[165,1444,226],{"class":215},[165,1446,317],{"class":215},[165,1448,1449,1451,1453,1455,1457,1459,1462,1464],{"class":167,"line":485},[165,1450,626],{"class":215},[165,1452,649],{"class":229},[165,1454,226],{"class":215},[165,1456,307],{"class":215},[165,1458,241],{"class":215},[165,1460,1461],{"class":229},"The user wants AI to provide advice, information lookup, and inspiration.",[165,1463,226],{"class":215},[165,1465,317],{"class":215},[165,1467,1468,1470,1472,1474,1476,1478,1480,1482],{"class":167,"line":490},[165,1469,626],{"class":215},[165,1471,346],{"class":229},[165,1473,226],{"class":215},[165,1475,307],{"class":215},[165,1477,241],{"class":215},[165,1479,677],{"class":229},[165,1481,226],{"class":215},[165,1483,317],{"class":215},[165,1485,1486,1488,1490,1492,1494],{"class":167,"line":552},[165,1487,626],{"class":215},[165,1489,688],{"class":229},[165,1491,226],{"class":215},[165,1493,307],{"class":215},[165,1495,695],{"class":215},[165,1497,1498,1500,1503,1505],{"class":167,"line":557},[165,1499,700],{"class":215},[165,1501,1502],{"class":229},"AI",[165,1504,226],{"class":215},[165,1506,317],{"class":215},[165,1508,1509,1511,1513,1515],{"class":167,"line":835},[165,1510,700],{"class":215},[165,1512,1379],{"class":229},[165,1514,226],{"class":215},[165,1516,317],{"class":215},[165,1518,1519,1521,1524],{"class":167,"line":852},[165,1520,700],{"class":215},[165,1522,1523],{"class":229},"type",[165,1525,247],{"class":215},[165,1527,1528],{"class":167,"line":857},[165,1529,743],{"class":215},[165,1531,1532],{"class":167,"line":863},[165,1533,748],{"class":215},[165,1535,1537],{"class":167,"line":1536},27,[165,1538,860],{"class":215},[165,1540,1542],{"class":167,"line":1541},28,[165,1543,366],{"class":215},[25,1545],{},[907,1547,1549],{"id":1548},"precisely-filter-the-memory-retrieval-scope","Precisely Filter the Memory Retrieval Scope",[14,1551,1552],{},"MemOS provides powerful memory filter functionality, allowing developers to accurately filter retrieved memories. This is especially useful for searching by memory characteristics such as creation time, tags, or metadata.",[45,1554,1555],{},[14,1556,1557],{},"Below is an example of using memory filters. Suppose a user wants an annual summary of all \"chat\" memories tagged with \"reading\" from 2025. You can filter for memories tagged \"reading\", created in 2025, and where the scene is \"chat\":",[152,1559,1560],{},[155,1561,1563],{"className":157,"code":1562,"filename":159,"language":160,"meta":161,"style":161},"import os\nimport json\nimport requests\n\nos.environ[\"MEMOS_API_KEY\"] = \"YOUR_API_KEY\"\nos.environ[\"MEMOS_BASE_URL\"] = \"https:\u002F\u002Fmemos.memtensor.cn\u002Fapi\u002Fopenmem\u002Fv1\"\n\n# Headers and base URL\nheaders = {\n  \"Authorization\": f\"Token {os.environ['MEMOS_API_KEY']}\",\n  \"Content-Type\": \"application\u002Fjson\"\n}\nBASE_URL = os.environ['MEMOS_BASE_URL']\n\nquery_text = \"My yearly reading summary\"\n\ndata = {\n    \"user_id\": \"memos_user_123\",\n    \"query\": query_text,\n    \"filter\": {\n        \"and\": [\n            {\"tags\": {\"contains\": \"reading\"}}, # Tags extracted by MemOS\n            {\"create_time\": {\"gte\": \"2025-01-01\"}}, # Memory creation time\n            {\"create_time\": {\"gte\": \"2025-12-31\"}}, # Memory creation time\n            {\"info\":{\"scene\":\"chat\"}} # Custom field set by developer when adding message\n        ]\n    } # Filter for all memories tagged \"reading\", created in 2025, in \"chat\" scene.\n}\n\n# Call \u002Fsearch\u002Fmemory to retrieve relevant memories\nres = requests.post(f\"{BASE_URL}\u002Fsearch\u002Fmemory\", headers=headers, data=json.dumps(data))\n\nprint(f\"result: {res.json()}\")\n",[141,1564,1565,1571,1577,1583,1587,1613,1639,1643,1647,1655,1693,1709,1713,1735,1739,1752,1756,1764,1782,1796,1809,1822,1860,1896,1929,1965,1970,1978,1982,1987,1992,2045,2050],{"__ignoreMap":161},[165,1566,1567,1569],{"class":167,"line":168},[165,1568,172],{"class":171},[165,1570,176],{"class":175},[165,1572,1573,1575],{"class":167,"line":179},[165,1574,172],{"class":171},[165,1576,192],{"class":175},[165,1578,1579,1581],{"class":167,"line":187},[165,1580,172],{"class":171},[165,1582,184],{"class":175},[165,1584,1585],{"class":167,"line":195},[165,1586,199],{"emptyLinePlaceholder":198},[165,1588,1589,1591,1593,1595,1597,1599,1601,1603,1605,1607,1609,1611],{"class":167,"line":202},[165,1590,212],{"class":175},[165,1592,216],{"class":215},[165,1594,220],{"class":219},[165,1596,223],{"class":215},[165,1598,226],{"class":215},[165,1600,230],{"class":229},[165,1602,226],{"class":215},[165,1604,235],{"class":215},[165,1606,238],{"class":215},[165,1608,241],{"class":215},[165,1610,244],{"class":229},[165,1612,247],{"class":215},[165,1614,1615,1617,1619,1621,1623,1625,1627,1629,1631,1633,1635,1637],{"class":167,"line":209},[165,1616,212],{"class":175},[165,1618,216],{"class":215},[165,1620,220],{"class":219},[165,1622,223],{"class":215},[165,1624,226],{"class":215},[165,1626,263],{"class":229},[165,1628,226],{"class":215},[165,1630,235],{"class":215},[165,1632,238],{"class":215},[165,1634,241],{"class":215},[165,1636,274],{"class":229},[165,1638,247],{"class":215},[165,1640,1641],{"class":167,"line":250},[165,1642,199],{"emptyLinePlaceholder":198},[165,1644,1645],{"class":167,"line":279},[165,1646,1016],{"class":205},[165,1648,1649,1651,1653],{"class":167,"line":284},[165,1650,372],{"class":175},[165,1652,290],{"class":215},[165,1654,293],{"class":215},[165,1656,1657,1659,1661,1663,1665,1667,1669,1671,1673,1675,1677,1679,1681,1683,1685,1687,1689,1691],{"class":167,"line":296},[165,1658,299],{"class":215},[165,1660,405],{"class":229},[165,1662,226],{"class":215},[165,1664,307],{"class":215},[165,1666,413],{"class":412},[165,1668,416],{"class":229},[165,1670,420],{"class":419},[165,1672,212],{"class":175},[165,1674,216],{"class":215},[165,1676,220],{"class":219},[165,1678,223],{"class":215},[165,1680,431],{"class":215},[165,1682,230],{"class":229},[165,1684,431],{"class":215},[165,1686,235],{"class":215},[165,1688,440],{"class":419},[165,1690,226],{"class":229},[165,1692,317],{"class":215},[165,1694,1695,1697,1699,1701,1703,1705,1707],{"class":167,"line":320},[165,1696,299],{"class":215},[165,1698,384],{"class":229},[165,1700,226],{"class":215},[165,1702,307],{"class":215},[165,1704,241],{"class":215},[165,1706,393],{"class":229},[165,1708,247],{"class":215},[165,1710,1711],{"class":167,"line":341},[165,1712,366],{"class":215},[165,1714,1715,1717,1719,1721,1723,1725,1727,1729,1731,1733],{"class":167,"line":363},[165,1716,1087],{"class":175},[165,1718,290],{"class":215},[165,1720,1092],{"class":175},[165,1722,216],{"class":215},[165,1724,220],{"class":219},[165,1726,223],{"class":215},[165,1728,431],{"class":215},[165,1730,263],{"class":229},[165,1732,431],{"class":215},[165,1734,1107],{"class":215},[165,1736,1737],{"class":167,"line":369},[165,1738,199],{"emptyLinePlaceholder":198},[165,1740,1741,1743,1745,1747,1750],{"class":167,"line":379},[165,1742,1121],{"class":175},[165,1744,290],{"class":215},[165,1746,241],{"class":215},[165,1748,1749],{"class":229},"My yearly reading summary",[165,1751,247],{"class":215},[165,1753,1754],{"class":167,"line":400},[165,1755,199],{"emptyLinePlaceholder":198},[165,1757,1758,1760,1762],{"class":167,"line":445},[165,1759,287],{"class":175},[165,1761,290],{"class":215},[165,1763,293],{"class":215},[165,1765,1766,1768,1770,1772,1774,1776,1778,1780],{"class":167,"line":450},[165,1767,1147],{"class":215},[165,1769,325],{"class":229},[165,1771,226],{"class":215},[165,1773,307],{"class":215},[165,1775,241],{"class":215},[165,1777,334],{"class":229},[165,1779,226],{"class":215},[165,1781,317],{"class":215},[165,1783,1784,1786,1788,1790,1792,1794],{"class":167,"line":485},[165,1785,1147],{"class":215},[165,1787,302],{"class":229},[165,1789,226],{"class":215},[165,1791,307],{"class":215},[165,1793,1174],{"class":175},[165,1795,317],{"class":215},[165,1797,1798,1800,1803,1805,1807],{"class":167,"line":490},[165,1799,1147],{"class":215},[165,1801,1802],{"class":229},"filter",[165,1804,226],{"class":215},[165,1806,307],{"class":215},[165,1808,293],{"class":215},[165,1810,1811,1813,1816,1818,1820],{"class":167,"line":552},[165,1812,700],{"class":215},[165,1814,1815],{"class":229},"and",[165,1817,226],{"class":215},[165,1819,307],{"class":215},[165,1821,695],{"class":215},[165,1823,1824,1827,1829,1831,1833,1835,1838,1840,1843,1845,1847,1849,1852,1854,1857],{"class":167,"line":557},[165,1825,1826],{"class":215},"            {",[165,1828,226],{"class":215},[165,1830,688],{"class":229},[165,1832,226],{"class":215},[165,1834,307],{"class":215},[165,1836,1837],{"class":215}," {",[165,1839,226],{"class":215},[165,1841,1842],{"class":229},"contains",[165,1844,226],{"class":215},[165,1846,307],{"class":215},[165,1848,241],{"class":215},[165,1850,1851],{"class":229},"reading",[165,1853,226],{"class":215},[165,1855,1856],{"class":215},"}},",[165,1858,1859],{"class":205}," # Tags extracted by MemOS\n",[165,1861,1862,1864,1866,1869,1871,1873,1875,1877,1880,1882,1884,1886,1889,1891,1893],{"class":167,"line":835},[165,1863,1826],{"class":215},[165,1865,226],{"class":215},[165,1867,1868],{"class":229},"create_time",[165,1870,226],{"class":215},[165,1872,307],{"class":215},[165,1874,1837],{"class":215},[165,1876,226],{"class":215},[165,1878,1879],{"class":229},"gte",[165,1881,226],{"class":215},[165,1883,307],{"class":215},[165,1885,241],{"class":215},[165,1887,1888],{"class":229},"2025-01-01",[165,1890,226],{"class":215},[165,1892,1856],{"class":215},[165,1894,1895],{"class":205}," # Memory creation time\n",[165,1897,1898,1900,1902,1904,1906,1908,1910,1912,1914,1916,1918,1920,1923,1925,1927],{"class":167,"line":852},[165,1899,1826],{"class":215},[165,1901,226],{"class":215},[165,1903,1868],{"class":229},[165,1905,226],{"class":215},[165,1907,307],{"class":215},[165,1909,1837],{"class":215},[165,1911,226],{"class":215},[165,1913,1879],{"class":229},[165,1915,226],{"class":215},[165,1917,307],{"class":215},[165,1919,241],{"class":215},[165,1921,1922],{"class":229},"2025-12-31",[165,1924,226],{"class":215},[165,1926,1856],{"class":215},[165,1928,1895],{"class":205},[165,1930,1931,1933,1935,1938,1940,1943,1945,1948,1950,1952,1954,1957,1959,1962],{"class":167,"line":857},[165,1932,1826],{"class":215},[165,1934,226],{"class":215},[165,1936,1937],{"class":229},"info",[165,1939,226],{"class":215},[165,1941,1942],{"class":215},":{",[165,1944,226],{"class":215},[165,1946,1947],{"class":229},"scene",[165,1949,226],{"class":215},[165,1951,307],{"class":215},[165,1953,226],{"class":215},[165,1955,1956],{"class":229},"chat",[165,1958,226],{"class":215},[165,1960,1961],{"class":215},"}}",[165,1963,1964],{"class":205}," # Custom field set by developer when adding message\n",[165,1966,1967],{"class":167,"line":863},[165,1968,1969],{"class":215},"        ]\n",[165,1971,1972,1975],{"class":167,"line":1536},[165,1973,1974],{"class":215},"    }",[165,1976,1977],{"class":205}," # Filter for all memories tagged \"reading\", created in 2025, in \"chat\" scene.\n",[165,1979,1980],{"class":167,"line":1541},[165,1981,366],{"class":215},[165,1983,1985],{"class":167,"line":1984},29,[165,1986,199],{"emptyLinePlaceholder":198},[165,1988,1990],{"class":167,"line":1989},30,[165,1991,1189],{"class":205},[165,1993,1995,1997,1999,2001,2003,2005,2007,2009,2011,2013,2015,2017,2019,2021,2023,2025,2027,2029,2031,2033,2035,2037,2039,2041,2043],{"class":167,"line":1994},31,[165,1996,493],{"class":175},[165,1998,290],{"class":215},[165,2000,498],{"class":175},[165,2002,216],{"class":215},[165,2004,504],{"class":503},[165,2006,507],{"class":215},[165,2008,565],{"class":412},[165,2010,226],{"class":229},[165,2012,420],{"class":419},[165,2014,1212],{"class":503},[165,2016,440],{"class":419},[165,2018,1217],{"class":229},[165,2020,518],{"class":215},[165,2022,521],{"class":510},[165,2024,290],{"class":215},[165,2026,526],{"class":503},[165,2028,518],{"class":215},[165,2030,531],{"class":510},[165,2032,290],{"class":215},[165,2034,536],{"class":503},[165,2036,216],{"class":215},[165,2038,541],{"class":503},[165,2040,507],{"class":215},[165,2042,546],{"class":503},[165,2044,549],{"class":215},[165,2046,2048],{"class":167,"line":2047},32,[165,2049,199],{"emptyLinePlaceholder":198},[165,2051,2053,2055,2057,2059,2061,2063,2065,2067,2069,2071,2073,2075],{"class":167,"line":2052},33,[165,2054,560],{"class":503},[165,2056,507],{"class":215},[165,2058,565],{"class":412},[165,2060,568],{"class":229},[165,2062,420],{"class":419},[165,2064,573],{"class":503},[165,2066,216],{"class":215},[165,2068,536],{"class":503},[165,2070,580],{"class":215},[165,2072,440],{"class":419},[165,2074,226],{"class":229},[165,2076,587],{"class":215},[45,2078,2079],{},[14,2080,2081,2082,216],{},"For more filter options, see ",[20,2083,2085],{"href":2084},"\u002Fmemos_cloud\u002Ffeatures\u002Fbasic\u002Ffilters","Memory Filter",[25,2087],{},[907,2089,2091],{"id":2090},"memory-retrieval-with-fewer-tokens","Memory Retrieval with Fewer Tokens",[14,2093,2094,2095,2102,2103,216],{},"To help the model get higher-quality and more token-efficient memory content (reducing the number of tokens injected), MemOS supports developer-specified ",[17,2096,2097,2098,2101],{},"Relevance Threshold (",[141,2099,2100],{},"relativity",")"," and ",[17,2104,2105,2106,2101],{},"max number of returned memories (",[141,2107,2108],{},"memory_limit_number",[14,2110,2111,2112,2102,2115,2118],{},"As shown below, setting ",[141,2113,2114],{},"relativity = 0.8",[141,2116,2117],{},"memory_limit_number = 9"," returns up to 9 memories, all with relevance above 0.8.",[155,2120,2122],{"className":157,"code":2121,"language":160,"meta":161,"style":161},"data = {\n    \"user_id\": \"memos_user_123\",\n    \"query\": \"Plan a 5-day trip to Chengdu for me.\",\n    \"relativity\": 0.8, # Relevance threshold. If not given, the default is 0 (no min relevance).\n    \"memory_limit_number\": 9 # Max number of memories to return. Default is 9 if not provided.\n}\n",[141,2123,2124,2132,2150,2169,2187,2203],{"__ignoreMap":161},[165,2125,2126,2128,2130],{"class":167,"line":168},[165,2127,287],{"class":175},[165,2129,290],{"class":215},[165,2131,293],{"class":215},[165,2133,2134,2136,2138,2140,2142,2144,2146,2148],{"class":167,"line":179},[165,2135,1147],{"class":215},[165,2137,325],{"class":229},[165,2139,226],{"class":215},[165,2141,307],{"class":215},[165,2143,241],{"class":215},[165,2145,334],{"class":229},[165,2147,226],{"class":215},[165,2149,317],{"class":215},[165,2151,2152,2154,2156,2158,2160,2162,2165,2167],{"class":167,"line":187},[165,2153,1147],{"class":215},[165,2155,302],{"class":229},[165,2157,226],{"class":215},[165,2159,307],{"class":215},[165,2161,241],{"class":215},[165,2163,2164],{"class":229},"Plan a 5-day trip to Chengdu for me.",[165,2166,226],{"class":215},[165,2168,317],{"class":215},[165,2170,2171,2173,2175,2177,2179,2182,2184],{"class":167,"line":195},[165,2172,1147],{"class":215},[165,2174,2100],{"class":229},[165,2176,226],{"class":215},[165,2178,307],{"class":215},[165,2180,2181],{"class":419}," 0.8",[165,2183,518],{"class":215},[165,2185,2186],{"class":205}," # Relevance threshold. If not given, the default is 0 (no min relevance).\n",[165,2188,2189,2191,2193,2195,2197,2200],{"class":167,"line":202},[165,2190,1147],{"class":215},[165,2192,2108],{"class":229},[165,2194,226],{"class":215},[165,2196,307],{"class":215},[165,2198,2199],{"class":419}," 9",[165,2201,2202],{"class":205}," # Max number of memories to return. Default is 9 if not provided.\n",[165,2204,2205],{"class":167,"line":209},[165,2206,366],{"class":215},[14,2208,2209,2210,2212],{},"Note: Currently, the ",[141,2211,2100],{}," field only takes effect for factual and preference memories.",[25,2214],{},[37,2216,2218],{"id":2217},"_7-more-functions","7. More Functions",[45,2220,2221],{},[14,2222,2223,2224,216],{}," For the complete list of API fields, formats, and more, see ",[20,2225,2226],{"href":22},"Search Memory API documentation",[2228,2229,2230,2252],"table",{},[2231,2232,2233],"thead",{},[2234,2235,2236,2242,2247],"tr",{},[2237,2238,2239],"th",{},[17,2240,2241],{},"Function",[2237,2243,2244],{},[17,2245,2246],{},"Related Fields",[2237,2248,2249],{},[17,2250,2251],{},"Description",[2253,2254,2255,2280,2306,2332],"tbody",{},[2234,2256,2257,2261,2277],{},[2258,2259,2260],"td",{},"Recall preference memories",[2258,2262,2263,2266,2268,2272,2274],{},[141,2264,2265],{},"include_preference",[25,2267],{},[165,2269,2271],{"style":2270},"line-height:0.6;"," ",[25,2273],{},[141,2275,2276],{},"preference_limit_number",[2258,2278,2279],{},"Preference memories are user preference information generated by MemOS based on user chat history. Enable this to recall user preferences in results.",[2234,2281,2282,2285,2299],{},[2258,2283,2284],{},"Recall tool memories",[2258,2286,2287,2290,2292,2294,2296],{},[141,2288,2289],{},"include_tool_memory",[25,2291],{},[165,2293,2271],{"style":2270},[25,2295],{},[141,2297,2298],{},"tool_memory_limit_number",[2258,2300,2301,2302,216],{},"Tool memories are generated by MemOS from tool invocation information you've added. Enable this to recall tool memories, see ",[20,2303,2305],{"href":2304},"\u002Fmemos_cloud\u002Ffeatures\u002Fadvanced\u002Ftool_calling","Tool Calling",[2234,2307,2308,2311,2325],{},[2258,2309,2310],{},"Recall skills",[2258,2312,2313,2316,2318,2320,2322],{},[141,2314,2315],{},"include_skill",[25,2317],{},[165,2319,2271],{"style":2270},[25,2321],{},[141,2323,2324],{},"skill_limit_number",[2258,2326,2327,2328,216],{},"Skills are reusable agent abilities generated from user memories. Enable this to recall skills, see ",[20,2329,2331],{"href":2330},"\u002Fmemos_cloud\u002Ffeatures\u002Fadvanced\u002Fskill","Skills",[2234,2333,2334,2337,2342],{},[2258,2335,2336],{},"Specify knowledge bases",[2258,2338,2339],{},[141,2340,2341],{},"knowledgebase_ids",[2258,2343,2344,2345,216],{},"Use this to restrict retrieval to specified project knowledge bases. This supports fine-grained permission control and flexible definition of accessible knowledge bases per user. See ",[20,2346,2348],{"href":2347},"\u002Fmemos_cloud\u002Ffeatures\u002Fadvanced\u002Fknowledge_base","Knowledge Base",[2350,2351,2352],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":161,"searchDepth":179,"depth":179,"links":2354},[2355,2356,2357,2358,2359,2360,2365],{"id":39,"depth":179,"text":40},{"id":70,"depth":179,"text":71},{"id":96,"depth":179,"text":97},{"id":149,"depth":179,"text":150},{"id":878,"depth":179,"text":879},{"id":904,"depth":179,"text":905,"children":2361},[2362,2363,2364],{"id":909,"depth":187,"text":910},{"id":1548,"depth":187,"text":1549},{"id":2090,"depth":187,"text":2091},{"id":2217,"depth":179,"text":2218},"MemOS recalls relevant memories through semantic retrieval and filtering capabilities.","md",{},"\u002Fen\u002Fmemos_cloud\u002Fmem_operations\u002Fsearch_memory",{"title":5,"description":161},"en\u002Fmemos_cloud\u002Fmem_operations\u002Fsearch_memory","cG2MUWRl_e0v2gIxJLQud_asprX7P_WFocMV4-9267A",[2374,2381],{"title":2375,"path":921,"stem":2376,"icon":2377,"framework":6,"module":6,"class":2378,"target":-1,"active":2379,"defaultOpen":2379,"children":-1,"description":2380},"Add Message","memos_cloud\u002Fmem_operations\u002Fadd_message","i-ri-message-3-line",[],false,"MemOS will automatically process the multimodal content you add—such as text, files, images—into personal, retrievable memories.",{"title":2382,"path":2383,"stem":2384,"icon":2385,"framework":6,"module":6,"class":2386,"target":-1,"active":2379,"defaultOpen":2379,"children":-1,"description":2387},"Delete Memory","\u002Fmemos_cloud\u002Fmem_operations\u002Fdelete_memory","memos_cloud\u002Fmem_operations\u002Fdelete_memory","i-ri-delete-bin-line",[],"Delete memories from MemOS, supporting batch deletion of memories for multiple users.",1775811151287]