MCPcopy Create free account
hub / github.com/MemTensor/MemOS / main

Function main

evaluation/scripts/PrefEval/pref_memu.py:176–322  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174
175
176def main():
177 parser = argparse.ArgumentParser(
178 description="Process conversations with MemOS. Run 'add', then 'search', then 'response'."
179 )
180 parser.add_argument(
181 "mode",
182 choices=["add", "search", "response"],
183 help="The mode to run the script in ('add', 'search', or 'response').",
184 )
185 parser.add_argument("--input", required=True, help="Path to the input JSONL file.")
186 parser.add_argument("--output", required=True, help="Path to the output JSONL file.")
187 parser.add_argument(
188 "--top-k",
189 type=int,
190 default=10,
191 help="Number of memories to retrieve (used in 'search' mode).",
192 )
193 parser.add_argument(
194 "--add-turn",
195 type=int,
196 choices=[0, 10, 300],
197 default=0,
198 help="Number of irrelevant turns to add (used in 'add' mode).",
199 )
200 parser.add_argument(
201 "--lib",
202 type=str,
203 choices=["memu"],
204 default="memu",
205 help="Which Memu library to use (used in 'add' mode).",
206 )
207 parser.add_argument(
208 "--version",
209 type=str,
210 default="0929-1",
211 help="Version identifier for user_id generation (used in 'add' mode).",
212 )
213 parser.add_argument(
214 "--max-workers", type=int, default=20, help="Maximum number of concurrent workers."
215 )
216
217 args = parser.parse_args()
218
219 try:
220 with open(args.input, encoding="utf-8") as infile:
221 lines = infile.readlines()
222 except FileNotFoundError:
223 print(f"Error: Input file '{args.input}' not found")
224 return
225
226 from utils.client import MemuClient
227
228 mem_client = MemuClient()
229
230 os.makedirs(f"results/prefeval/{args.lib}_{args.version}", exist_ok=True)
231 success_records = set()
232 record_file = f"results/prefeval/{args.lib}_{args.version}/success_records.txt"
233 if os.path.exists(record_file):

Callers 1

pref_memu.pyFile · 0.70

Calls 6

MemuClientClass · 0.90
setFunction · 0.85
submitMethod · 0.80
writeMethod · 0.65
openFunction · 0.50
addMethod · 0.45

Tested by

no test coverage detected