Week8 dkisselev-zz update

This commit is contained in:
Dmitry Kisselev
2025-10-29 02:07:03 -07:00
parent ba929c7ed4
commit d28039e255
81 changed files with 21291 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
"""Deployment and utility scripts."""

View File

@@ -0,0 +1,76 @@
#!/usr/bin/env python
"""Fetch and display valid colors and breeds from Petfinder API."""
import sys
from pathlib import Path
# Add parent directory to path
sys.path.insert(0, str(Path(__file__).parent.parent))
from agents.petfinder_agent import PetfinderAgent
def main():
"""Fetch and display valid cat colors and breeds from Petfinder API."""
print("=" * 70)
print("Fetching Valid Cat Data from Petfinder API")
print("=" * 70)
print()
try:
# Initialize agent
agent = PetfinderAgent()
# Fetch colors
print("📋 COLORS")
print("-" * 70)
colors = agent.get_valid_colors()
print(f"✓ Found {len(colors)} valid colors:")
print()
for i, color in enumerate(colors, 1):
print(f" {i:2d}. {color}")
print()
print("=" * 70)
print("Common user terms mapped to API colors:")
print("'tuxedo' → Black & White / Tuxedo")
print("'orange' → Orange / Red")
print("'gray' → Gray / Blue / Silver")
print("'orange tabby' → Tabby (Orange / Red)")
print("'calico' → Calico")
print()
# Fetch breeds
print("=" * 70)
print("📋 BREEDS")
print("-" * 70)
breeds = agent.get_valid_breeds()
print(f"✓ Found {len(breeds)} valid breeds:")
print()
# Show first 30 breeds
for i, breed in enumerate(breeds[:30], 1):
print(f" {i:2d}. {breed}")
if len(breeds) > 30:
print(f" ... and {len(breeds) - 30} more breeds")
print()
print("=" * 70)
print("These are the ONLY values accepted by Petfinder API")
print("Use these exact values when making API requests")
print("=" * 70)
print()
except Exception as e:
print(f"❌ Error: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,57 @@
#!/usr/bin/env python
"""Upload config.yaml to Modal volume for remote configuration."""
import modal
import yaml
from pathlib import Path
import sys
def main():
"""Upload config.yaml to Modal volume."""
# Load local config
config_path = Path("config.yaml")
if not config_path.exists():
print("❌ Error: config.yaml not found")
print("Copy config.example.yaml to config.yaml and configure it")
sys.exit(1)
try:
with open(config_path) as f:
config = yaml.safe_load(f)
except Exception as e:
print(f"❌ Error loading config.yaml: {e}")
sys.exit(1)
# Validate config
if config['deployment']['mode'] != 'production':
print("⚠️ Warning: config.yaml deployment mode is not set to 'production'")
try:
# Connect to Modal volume
volume = modal.Volume.from_name("tuxedo-link-data", create_if_missing=True)
# Remove old config if it exists
try:
volume.remove_file("/data/config.yaml")
print(" Removed old config.yaml")
except Exception:
# File doesn't exist, that's fine
pass
# Upload new config
with volume.batch_upload() as batch:
batch.put_file(config_path, "/data/config.yaml")
print("✓ Config uploaded to Modal volume")
print(f" Email provider: {config['email']['provider']}")
print(f" Deployment mode: {config['deployment']['mode']}")
except Exception as e:
print(f"❌ Error uploading config to Modal: {e}")
sys.exit(1)
if __name__ == "__main__":
main()