Spaces:
Sleeping
Sleeping
| """ | |
| Phase 1 Example: Simple single persona query | |
| This example demonstrates the basic functionality of querying | |
| a single persona about an urban planning topic. | |
| """ | |
| import sys | |
| from pathlib import Path | |
| # Add parent directory to path | |
| sys.path.insert(0, str(Path(__file__).parent.parent)) | |
| from src.pipeline.query_engine import QueryEngine | |
| def main(): | |
| print("=" * 70) | |
| print("Phase 1 Example: Single Persona Query") | |
| print("=" * 70) | |
| print() | |
| # Initialize the query engine | |
| print("Initializing system...") | |
| engine = QueryEngine() | |
| # Test system | |
| print("\nTesting system components...") | |
| if not engine.test_system(): | |
| print("System test failed. Please check your configuration.") | |
| return | |
| print("\n" + "=" * 70) | |
| print() | |
| # Define a planning question | |
| question = "What do you think about the proposed bike lane on Main Street?" | |
| # Query Sarah Chen (the progressive urban planner) | |
| print(f"Question: {question}") | |
| print("\nQuerying persona: Sarah Chen (Urban Planner)") | |
| print("-" * 70) | |
| response = engine.query( | |
| persona_id="sarah_chen", | |
| question=question, | |
| context_id="downtown_district", | |
| ) | |
| print(f"\n{response.persona_name} responds:") | |
| print(f"\n{response.response}") | |
| print() | |
| print("-" * 70) | |
| print(f"Generated at: {response.timestamp}") | |
| print(f"Model: {response.model_used}") | |
| print() | |
| if __name__ == "__main__": | |
| main() | |