Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions eval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -151,12 +151,12 @@
" \n",
" # Analyze the post\n",
" #download the avatar and convert to PIL image\n",
" avatar_uri = post['post']['author'].get('avatar')\n",
" avatar_uri = post['post']['author']['avatar']\n",
" avatar_response = requests.get(avatar_uri)\n",
" avatar_pil = Image.open(io.BytesIO(avatar_response.content))\n",
"\n",
" response_dict = analyze_post_sentiment(avatar_pil, post['post']['author']['displayName'], post['post']['record']['text'])\n",
" analysis = response_dict['llm_classification']\n",
" analysis = response_dict['response'].choices[0].message.content\n",
" weave_call_id = response_dict['weave_call_id']\n",
" \n",
" post_data = {\n",
Expand Down Expand Up @@ -298,7 +298,7 @@
" weave_call_id = None\n",
" \n",
" return {\n",
" \"llm_classification\": response.choices[0].message.content,\n",
" \"response\": response,\n",
" \"weave_call_id\": weave_call_id\n",
" }\n",
"\n",
Expand Down Expand Up @@ -493,7 +493,7 @@
" call_dict = dict(call)\n",
" row[\"input\"] = call_dict.get('inputs').get('text')\n",
" row[\"displayName\"] = call_dict.get('inputs').get('displayName')\n",
" row[\"llm_classification\"] = call_dict.get('output').get('llm_classification')\n",
" row[\"llm_classification\"] = call_dict.get('output').get('response').get('choices')[0].get('message').get('content')\n",
" list_of_feedback = call_dict.get('summary').get('weave').get('feedback')\n",
" for feedback in list_of_feedback:\n",
" if feedback.get(\"feedback_type\") == 'wandb.annotation.doomer_or_boomer':\n",
Expand All @@ -505,11 +505,10 @@
" \n",
" dataset.append(row)\n",
"\n",
" # weave.publish(weave.Dataset(name=\"doomer_or_boomer_dataset\", rows=dataset))\n",
" weave.publish(weave.Dataset(name=\"doomer_or_boomer_dataset\", rows=dataset))\n",
" return dataset\n",
"\n",
"dataset = get_annotated_calls()\n",
"print(dataset)"
"dataset = get_annotated_calls()"
]
},
{
Expand Down