Run system tests
()
| 897 | return memory_str |
| 898 | |
| 899 | def run_tests(): |
| 900 | """Run system tests""" |
| 901 | print("Starting Memory System Tests...") |
| 902 | |
| 903 | # Initialize memory system with OpenAI backend |
| 904 | memory_system = AgenticMemorySystem( |
| 905 | model_name='all-MiniLM-L6-v2', |
| 906 | llm_backend='openai', |
| 907 | llm_model='gpt-4o-mini' |
| 908 | ) |
| 909 | |
| 910 | print("\nAdding test memories...") |
| 911 | |
| 912 | # Add test memories - only content is required |
| 913 | memory_ids = [] |
| 914 | memory_ids.append(memory_system.add_note( |
| 915 | "Neural networks are composed of layers of neurons that process information." |
| 916 | )) |
| 917 | |
| 918 | memory_ids.append(memory_system.add_note( |
| 919 | "Data preprocessing involves cleaning and transforming raw data for model training." |
| 920 | )) |
| 921 | |
| 922 | print("\nQuerying for related memories...") |
| 923 | query = MemoryNote( |
| 924 | content="How do neural networks process data?", |
| 925 | llm_controller=memory_system.llm_controller |
| 926 | ) |
| 927 | |
| 928 | related = memory_system.find_related_memories(query.content, k=2) |
| 929 | print("related", related) |
| 930 | print("\nResults:") |
| 931 | for i, memory in enumerate(related, 1): |
| 932 | print(f"\n{i}. Memory:") |
| 933 | print(f"Content: {memory.content}") |
| 934 | print(f"Category: {memory.category}") |
| 935 | print(f"Keywords: {memory.keywords}") |
| 936 | print(f"Tags: {memory.tags}") |
| 937 | print(f"Context: {memory.context}") |
| 938 | print("-" * 50) |
| 939 | |
| 940 | if __name__ == "__main__": |
| 941 | run_tests() |
no test coverage detected