Skip to content

Commit

Permalink
fixed ch06
Browse files Browse the repository at this point in the history
  • Loading branch information
corradocavalli committed Nov 16, 2023
1 parent 8f41fa8 commit becb539
Show file tree
Hide file tree
Showing 3 changed files with 535 additions and 601 deletions.
18 changes: 12 additions & 6 deletions 04-prompt-engineering-fundamentals/1-introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,35 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"By the dawn's early light,\n"
]
}
],
"source": [
"# The OpenAI SDK was updated on Nov 8, 2023 with new guidance for migration\n",
"# See: https://github.com/openai/openai-python/discussions/742\n",
"\n",
"## Updated\n",
"import os\n",
"import openai\n",
"from openai import AzureOpenAI\n",
"\n",
"client = AzureOpenAI(\n",
" api_key=os.environ['AZURE_OPENAI_KEY'], # this is also the default, it can be omitted\n",
" api_version = \"2023-05-15\",\n",
" azure_endpoint = os.environ['AZURE_OPENAI_ENDPOINT']\n",
" api_version = \"2023-05-15\"\n",
" )\n",
"\n",
"deployment=os.environ['AZURE_OPENAI_DEPLOYMENT']\n",
"\n",
"## Updated\n",
"def get_completion(prompt):\n",
" messages = [{\"role\": \"user\", \"content\": prompt}]\n",
" messages = [{\"role\": \"user\", \"content\": prompt}] \n",
" response = client.chat.completions.create( \n",
" model=deployment, \n",
" messages=messages,\n",
Expand Down
Loading

0 comments on commit becb539

Please sign in to comment.