Clean and organize project structure
Major reorganization: - Created scripts/ directory for all utility scripts - Created config/ directory for configuration files - Moved all test files to tests/ directory - Updated all script paths to work with new structure - Updated README.md with new project structure diagram New structure: ├── src/ # Source code (API + MCP) ├── scripts/ # Utility scripts (start-*.sh, docs_server.py, etc.) ├── tests/ # All test files and debug utilities ├── config/ # Configuration files (JSON, Caddy config) ├── docs/ # Documentation website └── logs/ # Log files All scripts updated to use relative paths from project root. Documentation updated with new folder structure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
82
tests/debug_fact_extraction.py
Normal file
82
tests/debug_fact_extraction.py
Normal file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Debug the fact extraction system
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add the API directory to the path
|
||||
sys.path.insert(0, '/home/klas/langmem-project/src/api')
|
||||
|
||||
from fact_extraction import FactExtractor
|
||||
|
||||
async def debug_fact_extraction():
|
||||
"""Debug fact extraction"""
|
||||
print("🔍 Debugging Fact Extraction System")
|
||||
print("=" * 50)
|
||||
|
||||
# Test content
|
||||
test_content = "Ondrej has a son named Cyril who is 8 years old and loves playing soccer. Cyril goes to elementary school in Prague and his favorite color is blue. Ondrej works as a software engineer and lives in Czech Republic."
|
||||
|
||||
print(f"Content to extract facts from:")
|
||||
print(f"'{test_content}'")
|
||||
print()
|
||||
|
||||
# Create fact extractor
|
||||
extractor = FactExtractor()
|
||||
|
||||
print("1. Testing fact extraction...")
|
||||
facts = await extractor.extract_facts(test_content)
|
||||
|
||||
print(f"Extracted {len(facts)} facts:")
|
||||
for i, fact in enumerate(facts, 1):
|
||||
print(f" {i}. {fact}")
|
||||
|
||||
if not facts:
|
||||
print("❌ No facts extracted - there might be an issue with the extraction system")
|
||||
return False
|
||||
else:
|
||||
print("✅ Fact extraction working!")
|
||||
|
||||
print()
|
||||
|
||||
# Test memory action determination
|
||||
print("2. Testing memory action determination...")
|
||||
|
||||
existing_memories = [
|
||||
{
|
||||
"id": "test-memory-1",
|
||||
"content": "Ondrej has a son named Cyril",
|
||||
"similarity": 0.8
|
||||
}
|
||||
]
|
||||
|
||||
new_fact = "Ondrej has a son named Cyril who is 8 years old"
|
||||
|
||||
action_data = await extractor.determine_memory_action(new_fact, existing_memories)
|
||||
|
||||
print(f"New fact: '{new_fact}'")
|
||||
print(f"Action: {action_data.get('action', 'unknown')}")
|
||||
print(f"Reason: {action_data.get('reason', 'no reason')}")
|
||||
|
||||
return True
|
||||
|
||||
async def main():
|
||||
"""Main function"""
|
||||
try:
|
||||
success = await debug_fact_extraction()
|
||||
|
||||
if success:
|
||||
print("\n🎉 Fact extraction debugging complete!")
|
||||
else:
|
||||
print("\n❌ Fact extraction has issues that need to be fixed.")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error during debugging: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user