Supernova25million / demo_advanced_reasoning.py
algorythmtechnologies's picture
Upload folder using huggingface_hub
8174855 verified
#!/usr/bin/env python3
"""
Supernova Advanced Reasoning Demonstration
Shows the sophisticated AI capabilities added to your 25M parameter model.
"""
import sys
import os
# Add the supernova package to path
sys.path.append(os.path.dirname(__file__))
from chat_advanced import AdvancedSupernovaChat
def run_demonstration():
print("๐ŸŒŸ โœจ SUPERNOVA ADVANCED AI DEMONSTRATION โœจ ๐ŸŒŸ")
print("=" * 60)
print("Showing enhanced reasoning capabilities beyond basic ChatGPT-level responses")
print("=" * 60)
# Initialize the advanced chat system
try:
chat = AdvancedSupernovaChat(
config_path="./configs/supernova_25m.json",
api_keys_path="./configs/api_keys.yaml"
)
except Exception as e:
print(f"โŒ Failed to initialize chat system: {e}")
return
# Demo queries showing different types of advanced reasoning
demo_queries = [
{
"category": "๐Ÿงฎ Mathematical Reasoning",
"query": "Calculate the derivative of x^3 + 2x^2 - 5x + 1 and explain its significance",
"description": "Tests mathematical computation with contextual explanation"
},
{
"category": "๐Ÿ” Current Information Synthesis",
"query": "What are the latest developments in artificial intelligence in 2024?",
"description": "Tests web search integration with information synthesis"
},
{
"category": "๐Ÿง Complex Multi-Domain Analysis",
"query": "Analyze the implications of quantum computing on cybersecurity from both technical and business perspectives",
"description": "Tests multi-step reasoning across technology and business domains"
},
{
"category": "๐ŸŽ“ Educational Explanation",
"query": "Explain why machine learning models sometimes exhibit bias and how this can be mitigated",
"description": "Tests comprehensive explanation with nuanced understanding"
},
{
"category": "โš–๏ธ Comparative Analysis",
"query": "Compare and contrast renewable energy sources, considering environmental impact, cost, and scalability",
"description": "Tests structured comparative reasoning across multiple criteria"
}
]
for i, demo in enumerate(demo_queries, 1):
print(f"\n{'โ”€' * 60}")
print(f"๐Ÿงช DEMO {i}/5: {demo['category']}")
print(f"๐Ÿ“ Query: {demo['query']}")
print(f"๐ŸŽฏ Testing: {demo['description']}")
print(f"{'โ”€' * 60}")
try:
# Get response using advanced reasoning
response = chat.respond(demo['query'])
print(f"\n๐Ÿค– Supernova Response:")
print(response)
except Exception as e:
print(f"โŒ Error processing query: {e}")
# Pause between demos
if i < len(demo_queries):
input(f"\nโฏ๏ธ Press Enter to continue to Demo {i+1}...")
print(f"\n{'=' * 60}")
print("๐ŸŽ‰ DEMONSTRATION COMPLETE!")
print("=" * 60)
print("๐Ÿง  Key Advanced Features Demonstrated:")
print(" โ€ข Multi-step reasoning and problem decomposition")
print(" โ€ข Real-time information gathering and synthesis")
print(" โ€ข Cross-domain expertise analysis")
print(" โ€ข Sophisticated mathematical computation")
print(" โ€ข Context-aware response generation")
print(" โ€ข Evidence-based reasoning and conclusions")
print("\n๐Ÿ’ก Your Supernova model now exhibits reasoning patterns similar to advanced AI systems!")
print(f"{'=' * 60}")
def run_interactive_demo():
"""Interactive demonstration mode."""
print("\n๐ŸŽฎ INTERACTIVE ADVANCED REASONING MODE")
print("Ask complex questions to test the enhanced capabilities!")
print("Type 'quit' to exit.\n")
try:
chat = AdvancedSupernovaChat(
config_path="./configs/supernova_25m.json",
api_keys_path="./configs/api_keys.yaml"
)
chat.chat_loop()
except Exception as e:
print(f"โŒ Failed to start interactive mode: {e}")
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "--interactive":
run_interactive_demo()
else:
print("Choose demonstration mode:")
print("1. ๐Ÿงช Automated Demo (shows 5 different reasoning examples)")
print("2. ๐ŸŽฎ Interactive Mode (ask your own questions)")
choice = input("\nEnter choice (1 or 2): ").strip()
if choice == "1":
run_demonstration()
elif choice == "2":
run_interactive_demo()
else:
print("Invalid choice. Running automated demo...")
run_demonstration()