repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | import argparse |
| #2 | import os |
| #3 | |
| #4 | from src.langmem import LangMemManager |
| #5 | from src.memzero.add import MemoryADD |
| #6 | from src.memzero.search import MemorySearch |
| #7 | from src.openai.predict import OpenAIPredict |
| #8 | from src.rag import RAGManager |
| #9 | from src.utils import METHODS, TECHNIQUES |
| #10 | from src.zep.add import ZepAdd |
| #11 | from src.zep.search import ZepSearch |
| #12 | |
| #13 | |
| #14 | class Experiment: |
| #15 | def __init__(self, technique_type, chunk_size): |
| #16 | self.technique_type = technique_type |
| #17 | self.chunk_size = chunk_size |
| #18 | |
| #19 | def run(self): |
| #20 | print(f"Running experiment with technique: {self.technique_type}, chunk size: {self.chunk_size}") |
| #21 | |
| #22 | |
| #23 | def main(): |
| #24 | parser = argparse.ArgumentParser(description="Run memory experiments") |
| #25 | parser.add_argument("--technique_type", choices=TECHNIQUES, default="mem0", help="Memory technique to use") |
| #26 | parser.add_argument("--method", choices=METHODS, default="add", help="Method to use") |
| #27 | parser.add_argument("--chunk_size", type=int, default=1000, help="Chunk size for processing") |
| #28 | parser.add_argument("--output_folder", type=str, default="results/", help="Output path for results") |
| #29 | parser.add_argument("--top_k", type=int, default=30, help="Number of top memories to retrieve") |
| #30 | parser.add_argument("--filter_memories", action="store_true", default=False, help="Whether to filter memories") |
| #31 | parser.add_argument("--is_graph", action="store_true", default=False, help="Whether to use graph-based search") |
| #32 | parser.add_argument("--num_chunks", type=int, default=1, help="Number of chunks to process") |
| #33 | |
| #34 | args = parser.parse_args() |
| #35 | |
| #36 | # Add your experiment logic here |
| #37 | print(f"Running experiments with technique: {args.technique_type}, chunk size: {args.chunk_size}") |
| #38 | |
| #39 | if args.technique_type == "mem0": |
| #40 | if args.method == "add": |
| #41 | memory_manager = MemoryADD(data_path="dataset/locomo10.json", is_graph=args.is_graph) |
| #42 | memory_manager.process_all_conversations() |
| #43 | elif args.method == "search": |
| #44 | output_file_path = os.path.join( |
| #45 | args.output_folder, |
| #46 | f"mem0_results_top_{args.top_k}_filter_{args.filter_memories}_graph_{args.is_graph}.json", |
| #47 | ) |
| #48 | memory_searcher = MemorySearch(output_file_path, args.top_k, args.filter_memories, args.is_graph) |
| #49 | memory_searcher.process_data_file("dataset/locomo10.json") |
| #50 | elif args.technique_type == "rag": |
| #51 | output_file_path = os.path.join(args.output_folder, f"rag_results_{args.chunk_size}_k{args.num_chunks}.json") |
| #52 | rag_manager = RAGManager(data_path="dataset/locomo10_rag.json", chunk_size=args.chunk_size, k=args.num_chunks) |
| #53 | rag_manager.process_all_conversations(output_file_path) |
| #54 | elif args.technique_type == "langmem": |
| #55 | output_file_path = os.path.join(args.output_folder, "langmem_results.json") |
| #56 | langmem_manager = LangMemManager(dataset_path="dataset/locomo10_rag.json") |
| #57 | langmem_manager.process_all_conversations(output_file_path) |
| #58 | elif args.technique_type == "zep": |
| #59 | if args.method == "add": |
| #60 | zep_manager = ZepAdd(data_path="dataset/locomo10.json") |
| #61 | zep_manager.process_all_conversations("1") |
| #62 | elif args.method == "search": |
| #63 | output_file_path = os.path.join(args.output_folder, "zep_search_results.json") |
| #64 | zep_manager = ZepSearch() |
| #65 | zep_manager.process_data_file("dataset/locomo10.json", "1", output_file_path) |
| #66 | elif args.technique_type == "openai": |
| #67 | output_file_path = os.path.join(args.output_folder, "openai_results.json") |
| #68 | openai_manager = OpenAIPredict() |
| #69 | openai_manager.process_data_file("dataset/locomo10.json", output_file_path) |
| #70 | else: |
| #71 | raise ValueError(f"Invalid technique type: {args.technique_type}") |
| #72 | |
| #73 | |
| #74 | if __name__ == "__main__": |
| #75 | main() |
| #76 |