Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /promptdriven_pdd /context /context_generator_example.py
| import os | |
| from pdd.context_generator import context_generator | |
| from rich import print | |
| # Ensure PDD_PATH environment variable is set | |
| pdd_path = os.getenv('PDD_PATH') | |
| if not pdd_path: | |
| raise ValueError("PDD_PATH environment variable is not set") | |
| # Define input parameters | |
| code_module = "def add(a, b):\n return a + b" | |
| prompt = "Write a function 'add' that adds two numbers." | |
| language = "python" | |
| strength = 0.5 | |
| temperature = 0.0 | |
| # Call the context_generator function | |
| example_code, total_cost, model_name = context_generator( | |
| code_module=code_module, | |
| prompt=prompt, | |
| language=language, | |
| strength=strength, | |
| temperature=temperature, | |
| verbose=True | |
| ) | |
| # Print the results | |
| print("[bold]Generated Example Code:[/bold]") | |
| print(example_code) | |
| print(f"\n[bold]Total Cost:[/bold] ${total_cost:.6f}") | |
| print(f"[bold]Model Used:[/bold] {model_name}") |
Xet Storage Details
- Size:
- 861 Bytes
- Xet hash:
- a3ce9761b99d4e87dc46020aa5e02da8cb7665ef21001cb4c16bfdf246a7400e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.