diff --git a/summarize_yt/cli.py b/summarize_yt/cli.py index 027e6c5..b9382ec 100644 --- a/summarize_yt/cli.py +++ b/summarize_yt/cli.py @@ -18,12 +18,13 @@ from . import __version__ CLAUDE_COST_PER_1K_INPUT = 0.015 # Cost per 1K tokens for input CLAUDE_COST_PER_1K_OUTPUT = 0.075 # Cost per 1K tokens for output ESTIMATED_TOKENS_PER_CHAR = 0.25 # Rough estimate of tokens per character +HAIKU_OUTPUT_TOKENS = 50 # Haiku summaries are very short def estimate_api_cost(text: str) -> float: """Estimate the cost of sending text to Claude API.""" estimated_input_tokens = len(text) * ESTIMATED_TOKENS_PER_CHAR - estimated_output_tokens = 1024 # max_tokens setting + estimated_output_tokens = HAIKU_OUTPUT_TOKENS input_cost = (estimated_input_tokens / 1000) * CLAUDE_COST_PER_1K_INPUT output_cost = (estimated_output_tokens / 1000) * CLAUDE_COST_PER_1K_OUTPUT @@ -196,7 +197,7 @@ def get_summary_from_claude(text: str, duration_mins: int, prompt: str = None) - target_words = max(500, (duration_mins // 10) * 500) if prompt is None: - prompt = f"Please summarize this transcript in approximately {target_words} words" + prompt = "Please summarize this transcript as a haiku. A haiku is a three-line poem with 5 syllables in the first line, 7 syllables in the second line, and 5 syllables in the third line." message = client.messages.create( model="claude-3-sonnet-20240229", @@ -247,8 +248,8 @@ def main(): if not args.yes: try: - response = input("\nDo you want to proceed with getting the summary? (y/N): ").strip().lower() - if response != 'y': + response = input("\nDo you want to proceed with getting the summary? (Y/n): ").strip().lower() + if response == 'n': print("Operation cancelled by user.") cleanup_files(vtt_path) sys.exit(0)