Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /promptdriven_pdd /context /update_prompt_example.py
| import os | |
| from tabnanny import verbose | |
| from pdd.update_prompt import update_prompt | |
| from pdd import DEFAULT_STRENGTH | |
| def main() -> None: | |
| """ | |
| Main function to demonstrate the usage of the update_prompt function. | |
| """ | |
| # Define the input parameters | |
| input_prompt = "Please add two numbers and return the sum." | |
| input_code = "def add(a, b): return a + b" | |
| modified_code = "def mul_numbers(x, y): return x * y" | |
| strength = DEFAULT_STRENGTH # Example strength parameter for the LLM | |
| temperature = 0 # Example temperature parameter for the LLM | |
| try: | |
| # Call the update_prompt function | |
| modified_prompt, total_cost, model_name = update_prompt( | |
| input_prompt=input_prompt, | |
| input_code=input_code, | |
| modified_code=modified_code, | |
| strength=strength, | |
| temperature=temperature, | |
| verbose=True | |
| ) | |
| # Check the results | |
| if modified_prompt is not None: | |
| print(f"Modified Prompt: {modified_prompt}") | |
| print(f"Total Cost: ${total_cost:.6f}") | |
| print(f"Model Name: {model_name}") | |
| else: | |
| print("Failed to update the prompt.") | |
| except Exception as e: | |
| print(f"An error occurred: {e}") | |
| if __name__ == "__main__": | |
| main() |
Xet Storage Details
- Size:
- 1.3 kB
- Xet hash:
- 20e76d279b960bfea007b0fd81807735da8a3342d5b881160b2ef152eced013a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.