Skip to content

Commit

Permalink
Merge pull request #418 from wyl765/yonwa/fix-08-solution-bugs
Browse files Browse the repository at this point in the history
fix: fix 08 solution bugs
  • Loading branch information
koreyspace authored Jun 28, 2024
2 parents 95413c1 + f664be4 commit 084d635
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 08-building-search-applications/python/aoai-solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"load_dotenv()\n",
"\n",
"client = AzureOpenAI(\n",
" api_key=os.environ['AZURE_OPENAI_KEY'], # this is also the default, it can be omitted\n",
" api_key=os.environ['AZURE_OPENAI_API_KEY'], # this is also the default, it can be omitted\n",
" api_version = \"2023-05-15\"\n",
" )\n",
"\n",
Expand Down Expand Up @@ -71,6 +71,10 @@
"outputs": [],
"source": [
"def cosine_similarity(a, b):\n",
" if len(a) > len(b):\n",
" b = np.pad(b, (0, len(a) - len(b)), 'constant')\n",
" elif len(b) > len(a):\n",
" a = np.pad(a, (0, len(b) - len(a)), 'constant')\n",
" return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))\n",
"\n",
"def get_videos(\n",
Expand Down

0 comments on commit 084d635

Please sign in to comment.