Skip to content

Commit

Permalink
Fix notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
steventkrawczyk committed Jul 24, 2023
1 parent e1bc6fd commit 3fe8f7a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 535 deletions.
41 changes: 0 additions & 41 deletions examples/notebooks/GPT4vsLlama2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -280,48 +280,7 @@
"metadata": {},
"outputs": [],
"source": [
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
"from prompttools.utils import autoeval"
=======
"from prompttools.utils import autoeval\n",
"\n",
"\n",
"def extract_responses(output) -> str:\n",
" if \"text\" in output[\"choices\"][0]:\n",
" return [choice[\"text\"] for choice in output[\"choices\"]]\n",
" else:\n",
" return [choice[\"message\"][\"content\"] for choice in output[\"choices\"]]\n",
"\n",
"\n",
"def use_gpt4(\n",
" prompt: str, results: Dict, metadata: Dict\n",
") -> float:\n",
" \"\"\"\n",
" A simple test that checks semantic similarity between the user input\n",
" and the model's text responses.\n",
" \"\"\"\n",
" distances = [\n",
" autoeval.compute(prompt, response)\n",
" for response in extract_responses(results)\n",
" ]\n",
" return min(distances)\n"
]
},
{
"cell_type": "markdown",
"id": "974d6065",
"metadata": {},
"source": [
"Finally, we can evaluate and visualize the results."
>>>>>>> 975c0a9 (Update some examples)
=======
"from prompttools.utils import autoeval"
>>>>>>> da21a50 (More example updates)
=======
"from prompttools.utils import autoeval"
>>>>>>> 0d5ebb775deb7c53be2d25012bdff82e70febf93
]
},
{
Expand Down
Loading

0 comments on commit 3fe8f7a

Please sign in to comment.