Spaces:
Runtime error
Runtime error
| import os | |
| import sys | |
| # Add server directory to path | |
| sys.path.append('/Users/mac/Projects/customerAgent/server') | |
| from app.core.config import settings | |
| from app.services.tone_engine import ToneEngine | |
| def test_agent_name_customization(): | |
| print(f"Current AGENT_NAME set to: {settings.AGENT_NAME}") | |
| # Initialize ToneEngine | |
| engine = ToneEngine() | |
| # Test greeting | |
| greeting = engine.get_greeting(tone='friendly') | |
| print(f"Friendly Greeting: {greeting}") | |
| # Verify name is present | |
| if settings.AGENT_NAME in greeting: | |
| print("β SUCCESS: Agent name correctly included in greeting.") | |
| else: | |
| print(f"β FAILURE: Agent name '{settings.AGENT_NAME}' NOT found in greeting.") | |
| # Test tone modification | |
| response = "I am ready to help." | |
| modified = engine.apply_tone(response, tone='friendly') | |
| print(f"Modified Response: {modified}") | |
| if settings.AGENT_NAME in modified: | |
| print("β SUCCESS: Agent name correctly included in modified response.") | |
| else: | |
| print(f"β FAILURE: Agent name '{settings.AGENT_NAME}' NOT found in modified response.") | |
| if __name__ == "__main__": | |
| # Test with default Name | |
| print("--- Testing with default name ---") | |
| test_agent_name_customization() | |
| # Mocking environment variable change for demonstration in this script context | |
| # Note: In real usage, user would change .env and restart server | |
| print("\n--- Testing with custom name (Mocked) ---") | |
| settings.AGENT_NAME = "Iqra Bot" | |
| test_agent_name_customization() | |