Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /promptdriven_pdd /context /generate_test_example.py
| import os | |
| from pdd.generate_test import generate_test | |
| from rich import print | |
| # Set the PDD_PATH environment variable if not already set | |
| # os.environ['PDD_PATH'] = '/path/to/your/project' | |
| # Define input parameters | |
| prompt = "Write a function that calculates the factorial of a number" | |
| code = """ | |
| def factorial(n): | |
| if n == 0 or n == 1: | |
| return 1 | |
| else: | |
| return n * factorial(n-1) | |
| """ | |
| strength = 0.5 | |
| temperature = 0.0 | |
| language = "python" | |
| # Call the generate_test function | |
| try: | |
| unit_test, total_cost, model_name = generate_test(prompt, code, strength, temperature, language) | |
| print("[bold green]Generated Unit Test:[/bold green]") | |
| print(unit_test) | |
| print(f"[bold blue]Total Cost: ${total_cost:.6f}[/bold blue]") | |
| print(f"[bold]Model Used: {model_name}[/bold]") | |
| except Exception as e: | |
| print(f"[bold red]An error occurred: {e}[/bold red]") |
Xet Storage Details
- Size:
- 882 Bytes
- Xet hash:
- e4f33942955e7118d64cf53f70b77408f54114a32b894a35288e491b6090d724
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.