| |
| """ |
| Test script to validate ATLES fixes for conversation issues. |
| |
| This script tests the fixes for: |
| 1. Overly aggressive reasoning detection |
| 2. Malformed goal management commands |
| 3. Structured response format issues |
| """ |
|
|
| import sys |
| import os |
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) |
|
|
| def test_reasoning_detection(): |
| """Test that simple questions don't trigger reasoning engine.""" |
| print("π§ͺ Testing Reasoning Detection...") |
| |
| try: |
| from atles.ollama_client_enhanced import OllamaFunctionCaller |
| client = OllamaFunctionCaller() |
| |
| |
| simple_questions = [ |
| "hello atles what upgrades would you like to see", |
| "are you ok", |
| "can you see the issue", |
| "how are you", |
| "what can you do", |
| "hi there" |
| ] |
| |
| for question in simple_questions: |
| is_complex = client._is_complex_reasoning_scenario(question) |
| status = "β FAILED" if is_complex else "β
PASSED" |
| print(f" {status}: '{question}' -> Complex: {is_complex}") |
| |
| |
| complex_questions = [ |
| "what happens if I travel back in time and prevent my own birth - temporal paradox analysis", |
| "this statement is false - analyze the liar paradox", |
| "solve this logical puzzle about Russell's paradox in set theory" |
| ] |
| |
| for question in complex_questions: |
| is_complex = client._is_complex_reasoning_scenario(question) |
| status = "β
PASSED" if is_complex else "β FAILED" |
| print(f" {status}: '{question[:50]}...' -> Complex: {is_complex}") |
| |
| except Exception as e: |
| print(f" β ERROR: {e}") |
|
|
| def test_goal_management(): |
| """Test that goal management doesn't generate malformed commands.""" |
| print("\nπ― Testing Goal Management...") |
| |
| try: |
| from atles.ollama_client_enhanced import GoalManager |
| goal_manager = GoalManager() |
| |
| |
| test_request = "hello atles what upgrades would you like to see" |
| analysis = goal_manager.balance_goals(test_request) |
| |
| print(f" β
Goal analysis completed successfully") |
| print(f" π Detected goals: {analysis['detected_goals']}") |
| print(f" π― Primary goal: {analysis['conflict_resolution']['primary_goal']}") |
| |
| |
| balanced_approach = analysis['balanced_approach'] |
| if "analyze_goals:" in balanced_approach or "session_id" in balanced_approach: |
| print(f" β FAILED: Malformed commands found in goal analysis") |
| else: |
| print(f" β
PASSED: No malformed commands in goal analysis") |
| |
| except Exception as e: |
| print(f" β ERROR: {e}") |
|
|
| def test_prompt_generation(): |
| """Test that enhanced prompts don't confuse the AI.""" |
| print("\nπ Testing Prompt Generation...") |
| |
| try: |
| from atles.ollama_client_enhanced import OllamaFunctionCaller |
| client = OllamaFunctionCaller() |
| |
| |
| test_prompt = "hello atles what upgrades would you like to see" |
| |
| |
| goal_analysis = client.goal_manager.balance_goals(test_prompt) |
| |
| |
| if "analyze_goals" in str(goal_analysis): |
| print(f" β FAILED: Goal analysis contains function call references") |
| else: |
| print(f" β
PASSED: Goal analysis is clean") |
| |
| |
| if hasattr(client, 'available_functions'): |
| available_funcs = client.available_functions |
| if 'analyze_goals' in available_funcs: |
| print(f" β FAILED: analyze_goals still in available functions") |
| else: |
| print(f" β
PASSED: analyze_goals removed from available functions") |
| else: |
| print(f" βΉοΈ INFO: available_functions not initialized yet") |
| |
| except Exception as e: |
| print(f" β ERROR: {e}") |
|
|
| def main(): |
| """Run all tests.""" |
| print("π§ ATLES Conversation Fixes - Test Suite") |
| print("=" * 50) |
| |
| test_reasoning_detection() |
| test_goal_management() |
| test_prompt_generation() |
| |
| print("\n" + "=" * 50) |
| print("π― Test Summary:") |
| print("- Fixed overly aggressive reasoning detection") |
| print("- Removed malformed goal management commands") |
| print("- Simplified response guidance") |
| print("- Removed non-existent functions from available list") |
| print("\nβ
ATLES should now respond more naturally to simple questions!") |
|
|
| if __name__ == "__main__": |
| main() |
|
|