Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"assert RESOURCE_ENDPOINT, \"ERROR: Azure OpenAI Endpoint is missing\"\n",
"assert \"openai.azure.com\" in RESOURCE_ENDPOINT.lower(), \"ERROR: Azure OpenAI Endpoint should be in the form: \\n\\n\\t<your unique endpoint identifier>.openai.azure.com\"\n",
"openai.api_base = RESOURCE_ENDPOINT\n",
"deployment = \"gpt-35-turbo\" # replace with your deployment name"
"deployment = os.environ['AZURE_OPENAI_DEPLOYMENT']"
Copy link
Preview

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using os.environ['AZURE_OPENAI_DEPLOYMENT'] will raise a KeyError if the environment variable is not set. Consider using os.getenv('AZURE_OPENAI_DEPLOYMENT') with a default value or proper error handling to provide a better user experience.

Suggested change
"deployment = os.environ['AZURE_OPENAI_DEPLOYMENT']"
"deployment = os.getenv('AZURE_OPENAI_DEPLOYMENT', '').strip()\n",
"assert deployment, \"ERROR: Azure OpenAI Deployment name is missing\""

Copilot uses AI. Check for mistakes.

]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"outputs": [],
"source": [
"text = 'the quick brown fox jumped over the lazy dog'\n",
"model = 'text-embedding-ada-002'\n",
"model = os.getenv(\"AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT\")\n",
"\n",
"client.embeddings.create(input = [text], model=model).data[0].embedding"
]
Expand Down