From 48ea1d845aed1a98945ff032476fb6a6cdaf5541 Mon Sep 17 00:00:00 2001 From: Amirali Date: Thu, 29 May 2025 19:50:05 +0200 Subject: [PATCH] refactor: pass eval results to generate_eval_report to avoid redundant calculations --- agents/3-llm-loop/functions.py | 4 +--- agents/3-llm-loop/llm-loop-copywriter.ipynb | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/agents/3-llm-loop/functions.py b/agents/3-llm-loop/functions.py index f81e1be..69184e9 100644 --- a/agents/3-llm-loop/functions.py +++ b/agents/3-llm-loop/functions.py @@ -114,7 +114,7 @@ def run_all_evals(text, word_count_min=300, word_count_max=800, client_focus_min return results -def generate_eval_report(profile_text: str) -> str: +def generate_eval_report(profile_text: str, results: dict) -> str: """ Generates a markdown-formatted prompt for an LLM to revise an Upwork profile, with explicit strategies for word count and readability improvements. @@ -127,8 +127,6 @@ def generate_eval_report(profile_text: str) -> str: """ status_emoji = {True: "✅ Passed", False: "❌ Failed"} - results = run_all_evals(profile_text) - notes = { "word_count": { True: "Your profile is within the ideal range of 300 words.", diff --git a/agents/3-llm-loop/llm-loop-copywriter.ipynb b/agents/3-llm-loop/llm-loop-copywriter.ipynb index 282aafb..47e8edd 100644 --- a/agents/3-llm-loop/llm-loop-copywriter.ipynb +++ b/agents/3-llm-loop/llm-loop-copywriter.ipynb @@ -202,7 +202,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "c3937b9f-7fe7-41d4-8ac2-1a0e4582cafe", "metadata": {}, "outputs": [ @@ -234,7 +234,7 @@ " print(results)\n", "\n", " # craft new prompt with feedback\n", - " prompt = generate_eval_report(new_profile)\n", + " prompt = generate_eval_report(new_profile, results)\n", "\n", " # check if all tests passed\n", " all_passed = all(results.values())\n",