Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /promptdriven_pdd /context /split_main_example.py
| # example_split_usage.py | |
| import click | |
| # Import the split_main function from wherever your module is located | |
| from pdd.split_main import split_main | |
| def split_cli(ctx, input_prompt_file: str, input_code_file: str, example_code_file: str, | |
| output_sub: str, output_modified: str, force: bool, quiet: bool): | |
| """ | |
| Example CLI command demonstrating how to call the split_main function. | |
| Usage: | |
| python example_split_usage.py split-cli \ | |
| --input-prompt-file "prompt.txt" \ | |
| --input-code-file "generated_code.py" \ | |
| --example-code-file "example_usage.py" \ | |
| --output-sub "sub_prompt.txt" \ | |
| --output-modified "modified_prompt.txt" \ | |
| --force | |
| """ | |
| # Make any custom settings for split_main | |
| ctx.obj = { | |
| "strength": 0.5, # Example of adjusting how much is removed into the sub-prompt | |
| "temperature": 0 # Example for controlling randomness | |
| } | |
| try: | |
| # Pass CLI parameters to split_main with the standardized return order | |
| # Returns (result_data, total_cost, model_name) | |
| result_data, total_cost, model_name = split_main( | |
| ctx, | |
| input_prompt_file=input_prompt_file, | |
| input_code_file=input_code_file, | |
| example_code_file=example_code_file, | |
| output_sub=output_sub, | |
| output_modified=output_modified | |
| ) | |
| # Optionally, post-process or display the results here | |
| if not quiet: | |
| # Access the content from the result dictionary | |
| click.echo(f"Sub-prompt content returned:\n{result_data['sub_prompt_content']}") | |
| click.echo(f"Modified prompt content returned:\n{result_data['modified_prompt_content']}") | |
| click.echo(f"Sub-prompt saved to: {result_data['output_sub']}") | |
| click.echo(f"Modified prompt saved to: {result_data['output_modified']}") | |
| click.echo(f"Model used: {model_name}") | |
| click.echo(f"Total cost of operation: ${total_cost:.6f}") | |
| except Exception as e: | |
| click.echo(f"An error occurred: {e}", err=True) | |
| if not quiet: | |
| raise | |
| def cli(): | |
| """Top-level CLI group.""" | |
| pass | |
| cli.add_command(split_cli, name="split-cli") | |
| if __name__ == "__main__": | |
| cli() |
Xet Storage Details
- Size:
- 3.04 kB
- Xet hash:
- a45284153f3f80366ebae0cc5a16a72493a11a7dc6ae14ad55a1679c9c6e5d9e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.