Skip to content

Commit

Permalink
Clear notebook outputs
Browse files Browse the repository at this point in the history
Signed-off-by: Sternakt <[email protected]>
  • Loading branch information
sternakt committed Dec 4, 2024
1 parent 030ca56 commit 89ac536
Showing 1 changed file with 9 additions and 81 deletions.
90 changes: 9 additions & 81 deletions notebook/agentchat_structured_outputs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/tvrtko/ag2/.venv/lib/python3.9/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"outputs": [],
"source": [
"import autogen\n",
"\n",
Expand Down Expand Up @@ -91,7 +82,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -122,7 +113,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -152,36 +143,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mUser_proxy\u001b[0m (to Math_solver):\n",
"\n",
"how can I solve 8x + 7 = -23\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[33mMath_solver\u001b[0m (to User_proxy):\n",
"\n",
"{\"steps\":[{\"explanation\":\"Start with the given equation: 8x + 7 = -23. The goal is to isolate 'x' on one side of the equation. First, we will subtract 7 from both sides to eliminate the constant term from the left side of the equation.\",\"output\":\"8x + 7 - 7 = -23 - 7\"},{\"explanation\":\"Now, simplify both sides of the equation. On the left, 7 - 7 equals 0, leaving us with 8x. On the right, -23 - 7 equals -30.\",\"output\":\"8x = -30\"},{\"explanation\":\"The equation 8x = -30 means 8 times x equals -30. To find the value of x, we need to divide both sides of the equation by 8 (the coefficient of x) to solve for x.\",\"output\":\"x = -30 / 8\"},{\"explanation\":\"Simplify the fraction on the right side. -30 divided by 8 equals -3.75, so x = -3.75 is the solution to the equation.\",\"output\":\"x = -3.75\"}],\"final_answer\":\"x = -3.75\"}\n",
"\n",
"--------------------------------------------------------------------------------\n"
]
},
{
"data": {
"text/plain": [
"ChatResult(chat_id=None, chat_history=[{'content': 'how can I solve 8x + 7 = -23', 'role': 'assistant', 'name': 'User_proxy'}, {'content': '{\"steps\":[{\"explanation\":\"Start with the given equation: 8x + 7 = -23. The goal is to isolate \\'x\\' on one side of the equation. First, we will subtract 7 from both sides to eliminate the constant term from the left side of the equation.\",\"output\":\"8x + 7 - 7 = -23 - 7\"},{\"explanation\":\"Now, simplify both sides of the equation. On the left, 7 - 7 equals 0, leaving us with 8x. On the right, -23 - 7 equals -30.\",\"output\":\"8x = -30\"},{\"explanation\":\"The equation 8x = -30 means 8 times x equals -30. To find the value of x, we need to divide both sides of the equation by 8 (the coefficient of x) to solve for x.\",\"output\":\"x = -30 / 8\"},{\"explanation\":\"Simplify the fraction on the right side. -30 divided by 8 equals -3.75, so x = -3.75 is the solution to the equation.\",\"output\":\"x = -3.75\"}],\"final_answer\":\"x = -3.75\"}', 'role': 'user', 'name': 'Math_solver'}], summary='{\"steps\":[{\"explanation\":\"Start with the given equation: 8x + 7 = -23. The goal is to isolate \\'x\\' on one side of the equation. First, we will subtract 7 from both sides to eliminate the constant term from the left side of the equation.\",\"output\":\"8x + 7 - 7 = -23 - 7\"},{\"explanation\":\"Now, simplify both sides of the equation. On the left, 7 - 7 equals 0, leaving us with 8x. On the right, -23 - 7 equals -30.\",\"output\":\"8x = -30\"},{\"explanation\":\"The equation 8x = -30 means 8 times x equals -30. To find the value of x, we need to divide both sides of the equation by 8 (the coefficient of x) to solve for x.\",\"output\":\"x = -30 / 8\"},{\"explanation\":\"Simplify the fraction on the right side. -30 divided by 8 equals -3.75, so x = -3.75 is the solution to the equation.\",\"output\":\"x = -3.75\"}],\"final_answer\":\"x = -3.75\"}', cost={'usage_including_cached_inference': {'total_cost': 0.003945000000000001, 'gpt-4o-2024-08-06': {'cost': 0.003945000000000001, 'prompt_tokens': 582, 'completion_tokens': 249, 'total_tokens': 831}}, 'usage_excluding_cached_inference': {'total_cost': 0.003945000000000001, 'gpt-4o-2024-08-06': {'cost': 0.003945000000000001, 'prompt_tokens': 582, 'completion_tokens': 249, 'total_tokens': 831}}}, human_input=[])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"user_proxy.initiate_chat(assistant, message=\"how can I solve 8x + 7 = -23\", max_turns=1, summary_method=\"last_msg\")"
]
Expand All @@ -206,7 +170,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -242,45 +206,9 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mUser_proxy\u001b[0m (to Math_solver):\n",
"\n",
"how can I solve 4x + 8 = -40\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[33mMath_solver\u001b[0m (to User_proxy):\n",
"\n",
"Step 1: First, we need to isolate the variable term (4x) on one side of the equation. We do this by subtracting 8 from both sides of the equation.\n",
" Output: 4x + 8 - 8 = -40 - 8\n",
"Step 2: Simplifying both sides gives us a new equation: 4x = -48.\n",
" Output: 4x = -48\n",
"Step 3: Next, we solve for x by dividing both sides of the equation by 4.\n",
" Output: 4x/4 = -48/4\n",
"Step 4: Simplifying this gives us the solution for x: x = -12.\n",
" Output: x = -12\n",
"\n",
"Final Answer: x = -12\n",
"\n",
"--------------------------------------------------------------------------------\n"
]
},
{
"data": {
"text/plain": [
"ChatResult(chat_id=None, chat_history=[{'content': 'how can I solve 4x + 8 = -40', 'role': 'assistant', 'name': 'User_proxy'}, {'content': 'Step 1: First, we need to isolate the variable term (4x) on one side of the equation. We do this by subtracting 8 from both sides of the equation.\\n Output: 4x + 8 - 8 = -40 - 8\\nStep 2: Simplifying both sides gives us a new equation: 4x = -48.\\n Output: 4x = -48\\nStep 3: Next, we solve for x by dividing both sides of the equation by 4.\\n Output: 4x/4 = -48/4\\nStep 4: Simplifying this gives us the solution for x: x = -12.\\n Output: x = -12\\n\\nFinal Answer: x = -12', 'role': 'user', 'name': 'Math_solver'}], summary='Step 1: First, we need to isolate the variable term (4x) on one side of the equation. We do this by subtracting 8 from both sides of the equation.\\n Output: 4x + 8 - 8 = -40 - 8\\nStep 2: Simplifying both sides gives us a new equation: 4x = -48.\\n Output: 4x = -48\\nStep 3: Next, we solve for x by dividing both sides of the equation by 4.\\n Output: 4x/4 = -48/4\\nStep 4: Simplifying this gives us the solution for x: x = -12.\\n Output: x = -12\\n\\nFinal Answer: x = -12', cost={'usage_including_cached_inference': {'total_cost': 0.0029850000000000002, 'gpt-4o-2024-08-06': {'cost': 0.0029850000000000002, 'prompt_tokens': 582, 'completion_tokens': 153, 'total_tokens': 735}}, 'usage_excluding_cached_inference': {'total_cost': 0.0029850000000000002, 'gpt-4o-2024-08-06': {'cost': 0.0029850000000000002, 'prompt_tokens': 582, 'completion_tokens': 153, 'total_tokens': 735}}}, human_input=[])"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"llm_config = {\"config_list\": config_list, \"cache_seed\": 42}\n",
"\n",
Expand Down

0 comments on commit 89ac536

Please sign in to comment.