researchpath / scripts /smoke_test.py
Chetan110801's picture
Upload folder using huggingface_hub
2f25a40 verified
Raw
History Blame Contribute Delete
1.6 kB
"""Day 1 smoke test: verify both Gemini and Groq API keys work end-to-end.
Usage:
uv run python scripts/smoke_test.py
"""
from __future__ import annotations
import sys
from pathlib import Path
# Make `researchpath` importable when running this file directly.
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from rich.console import Console
from researchpath.llm import gemini_generate, groq_generate
console = Console()
PROMPT = "In one sentence, what is policy gradient in reinforcement learning?"
def run_provider(name: str, fn) -> bool:
console.print(f"[bold cyan]Testing {name}...[/bold cyan]")
try:
result = fn(PROMPT)
console.print(f"[green]OK[/green] {name} ({result.model}):")
console.print(f" {result.text.strip()}")
if result.input_tokens is not None:
console.print(
f" [dim]tokens: {result.input_tokens} in / {result.output_tokens} out[/dim]"
)
console.print()
return True
except Exception as e:
console.print(f"[red]FAIL {name}:[/red] {e}\n")
return False
def main() -> int:
console.print("[bold]ResearchPath smoke test[/bold]\n")
results = [
run_provider("Gemini", gemini_generate),
run_provider("Groq", groq_generate),
]
if all(results):
console.print("[bold green]All providers working. You're ready for Day 2.[/bold green]")
return 0
console.print("[bold red]One or more providers failed. Fix and re-run.[/bold red]")
return 1
if __name__ == "__main__":
sys.exit(main())