add: cheshire-cat configuration, tooling, tests, and documentation
Configuration: - .env.example, .gitignore, compose.yml (main docker compose) - docker-compose-amd.yml (ROCm), docker-compose-macos.yml - start.sh, stop.sh convenience scripts - LICENSE (Apache 2.0, from upstream Cheshire Cat) Memory management utilities: - analyze_consolidation.py, manual_consolidation.py, verify_consolidation.py - check_memories.py, extract_declarative_facts.py, store_declarative_facts.py - compare_systems.py (system comparison tool) - benchmark_cat.py, streaming_benchmark.py, streaming_benchmark_v2.py Test suite: - quick_test.py, test_setup.py, test_setup_simple.py - test_consolidation_direct.py, test_declarative_recall.py, test_recall.py - test_end_to_end.py, test_full_pipeline.py - test_phase2.py, test_phase2_comprehensive.py Documentation: - README.md, QUICK_START.txt, TEST_README.md, SETUP_COMPLETE.md - PHASE2_IMPLEMENTATION_NOTES.md, PHASE2_TEST_RESULTS.md - POST_OPTIMIZATION_ANALYSIS.md
This commit is contained in:
194
cheshire-cat/test_phase2_comprehensive.py
Executable file
194
cheshire-cat/test_phase2_comprehensive.py
Executable file
@@ -0,0 +1,194 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Comprehensive Phase 2 Test - Memory Consolidation
|
||||
|
||||
This test tells Miku a rich variety of information to test consolidation:
|
||||
- Trivial messages (should be deleted)
|
||||
- Important personal facts (should be kept)
|
||||
- Emotional events (should be kept)
|
||||
- Mundane chitchat (might be kept or deleted)
|
||||
- Complex conversations (should be analyzed intelligently)
|
||||
|
||||
After sending all messages, we'll:
|
||||
1. Run manual consolidation
|
||||
2. Check what was kept vs deleted
|
||||
3. Verify Miku remembers the important stuff
|
||||
4. Check if facts were extracted to declarative memory
|
||||
"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
CAT_URL = "http://localhost:1865"
|
||||
TEST_USER_ID = "discord_user_comprehensive_test"
|
||||
|
||||
|
||||
def send_message(text: str, category: str = ""):
|
||||
"""Send a message to Miku"""
|
||||
print(f" [{category}] '{text}'")
|
||||
|
||||
payload = {
|
||||
"text": text,
|
||||
"user_id": TEST_USER_ID
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(
|
||||
f"{CAT_URL}/message",
|
||||
json=payload,
|
||||
timeout=30
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
return True
|
||||
else:
|
||||
print(f" ❌ Error: {response.status_code}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f" ❌ Exception: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
print("=" * 70)
|
||||
print("COMPREHENSIVE PHASE 2 TEST")
|
||||
print("=" * 70)
|
||||
print("\n📤 Sending diverse messages to test consolidation...")
|
||||
|
||||
test_messages = {
|
||||
"TRIVIAL - Should DELETE": [
|
||||
"lol",
|
||||
"k",
|
||||
"ok",
|
||||
"lmao",
|
||||
"haha",
|
||||
"xd",
|
||||
"brb",
|
||||
"gtg",
|
||||
],
|
||||
|
||||
"PERSONAL FACTS - Should KEEP": [
|
||||
"My name is Sarah Chen",
|
||||
"I'm 24 years old",
|
||||
"I live in Seattle, Washington",
|
||||
"I work as a software engineer at Microsoft",
|
||||
"My birthday is March 15th",
|
||||
"I graduated from UC Berkeley in 2022",
|
||||
"My phone number is 555-0123",
|
||||
"My email is sarah.chen@example.com",
|
||||
],
|
||||
|
||||
"EMOTIONAL EVENTS - Should KEEP": [
|
||||
"I just got engaged to my boyfriend yesterday! I'm so happy!",
|
||||
"My grandmother passed away last week. I'm really struggling with it.",
|
||||
"I finally got promoted to senior engineer after 3 years of hard work!",
|
||||
"My cat Luna died this morning. She was 16 years old. I'm devastated.",
|
||||
"I had a panic attack at work today. It was really embarrassing.",
|
||||
"I've been diagnosed with ADHD and just started medication.",
|
||||
],
|
||||
|
||||
"HOBBIES & INTERESTS - Should KEEP": [
|
||||
"I love playing piano. I've been playing for 15 years.",
|
||||
"I'm learning Japanese! Currently at N3 level.",
|
||||
"I'm a huge fan of Studio Ghibli films, especially Spirited Away.",
|
||||
"I collect vinyl records. I have about 200 albums so far.",
|
||||
"I run marathons. Just completed my 5th one last month!",
|
||||
],
|
||||
|
||||
"RELATIONSHIPS - Should KEEP": [
|
||||
"My best friend is Emma. We've known each other since kindergarten.",
|
||||
"My mom's name is Jennifer and she's a high school teacher.",
|
||||
"I have a younger brother named Alex who's in college.",
|
||||
"My fiance's name is David. We met at work 3 years ago.",
|
||||
],
|
||||
|
||||
"MUNDANE CHITCHAT - Might DELETE": [
|
||||
"What's up?",
|
||||
"How are you?",
|
||||
"That's cool",
|
||||
"I see",
|
||||
"Interesting",
|
||||
"Nice",
|
||||
"Yeah",
|
||||
],
|
||||
|
||||
"OPINIONS & PREFERENCES - Should KEEP": [
|
||||
"I absolutely hate cilantro. It tastes like soap to me.",
|
||||
"My favorite color is forest green.",
|
||||
"I prefer cats over dogs, though I like both.",
|
||||
"I'm vegetarian for ethical reasons.",
|
||||
"I think pineapple on pizza is delicious, fight me!",
|
||||
],
|
||||
|
||||
"CURRENT EVENTS - Might KEEP (recent context)": [
|
||||
"I'm planning a trip to Japan in May.",
|
||||
"I'm looking for a new apartment closer to downtown.",
|
||||
"I've been dealing with insomnia lately.",
|
||||
"I'm taking a pottery class on weekends.",
|
||||
],
|
||||
|
||||
"TRIVIAL QUESTIONS - Might DELETE": [
|
||||
"What's your favorite food?",
|
||||
"Do you like music?",
|
||||
"Can you sing?",
|
||||
],
|
||||
|
||||
"MEANINGFUL QUESTIONS - Might KEEP": [
|
||||
"Do you think AI will ever truly understand human emotions?",
|
||||
"What's your opinion on the ethics of AI development?",
|
||||
],
|
||||
|
||||
"SMALL TALK - Might DELETE": [
|
||||
"It's raining today",
|
||||
"I had coffee this morning",
|
||||
"The weather is nice",
|
||||
],
|
||||
}
|
||||
|
||||
stats = {
|
||||
"total": 0,
|
||||
"sent": 0,
|
||||
"failed": 0
|
||||
}
|
||||
|
||||
# Send all messages
|
||||
for category, messages in test_messages.items():
|
||||
print(f"\n{category}:")
|
||||
for msg in messages:
|
||||
stats["total"] += 1
|
||||
if send_message(msg, category):
|
||||
stats["sent"] += 1
|
||||
time.sleep(0.5) # Polite delay
|
||||
else:
|
||||
stats["failed"] += 1
|
||||
|
||||
print("\n" + "=" * 70)
|
||||
print("SENDING COMPLETE")
|
||||
print("=" * 70)
|
||||
print(f"Total messages: {stats['total']}")
|
||||
print(f"✅ Sent: {stats['sent']}")
|
||||
print(f"❌ Failed: {stats['failed']}")
|
||||
|
||||
print("\n" + "=" * 70)
|
||||
print("NEXT STEPS:")
|
||||
print("=" * 70)
|
||||
print("1. Run manual consolidation:")
|
||||
print(" cd /home/koko210Serve/docker/miku-discord/cheshire-cat")
|
||||
print(" source venv/bin/activate")
|
||||
print(" python3 manual_consolidation.py")
|
||||
print("")
|
||||
print("2. Verify what was kept:")
|
||||
print(" python3 verify_consolidation.py")
|
||||
print("")
|
||||
print("3. Test Miku's memory:")
|
||||
print(" curl -X POST http://localhost:1865/message \\")
|
||||
print(" -H 'Content-Type: application/json' \\")
|
||||
print(" -d '{\"text\": \"Tell me everything you know about me\", \"user_id\": \"discord_user_comprehensive_test\"}'")
|
||||
print("")
|
||||
print("=" * 70)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user