Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes: add missing dependency, use the env var for deployment #91

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
7 changes: 5 additions & 2 deletions demo-python/code/azure-search-vector-python-sample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"source": [
"! pip install azure-search-documents --pre\n",
"! pip install openai\n",
"! pip install python-dotenv"
"! pip install python-dotenv\n",
"! pip install tenacity\n",
"! pip install openai[datalib]"
]
},
{
Expand Down Expand Up @@ -71,6 +73,7 @@
"openai.api_key = os.getenv(\"AZURE_OPENAI_API_KEY\") \n",
"openai.api_base = os.getenv(\"AZURE_OPENAI_ENDPOINT\") \n",
"openai.api_version = os.getenv(\"AZURE_OPENAI_API_VERSION\") \n",
"embedding_deployment_model = os.getenv(\"AZURE_OPENAI_EMBEDDING_DEPLOYED_MODEL\")\n",
"credential = AzureKeyCredential(key)"
]
},
Expand Down Expand Up @@ -99,7 +102,7 @@
"# Function to generate embeddings for title and content fields, also used for query embeddings\n",
"def generate_embeddings(text):\n",
" response = openai.Embedding.create(\n",
" input=text, engine=\"text-embedding-ada-002\")\n",
" input=text, engine=embedding_deployment_model)\n",
" embeddings = response['data'][0]['embedding']\n",
" return embeddings\n",
"\n",
Expand Down