-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pull main changes into working (#32)
* added stepped notebooks for content delivery * adding contoso products manuals * adding contoso-manuals-index creation * cleaning notebook * added intent connections to round out full connectivity * corrected environment issue and renamed local eval run
- Loading branch information
1 parent
82e750a
commit 1096c2d
Showing
29 changed files
with
4,615 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install azure-ai-generative[evaluate,index,promptflow]==1.0.0b3" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"from azure.ai.resources.client import AIClient\n", | ||
"from azure.ai.resources.operations._index_data_source import (\n", | ||
" LocalSource,\n", | ||
" ACSOutputConfig,\n", | ||
")\n", | ||
"from azure.ai.generative.index import build_index\n", | ||
"from azure.identity import DefaultAzureCredential\n", | ||
"from dotenv import load_dotenv\n", | ||
"\n", | ||
"load_dotenv()\n", | ||
"\n", | ||
"contoso_search = os.environ[\"CONTOSO_SEARCH_SERVICE\"]\n", | ||
"contoso_search_key = os.environ[\"CONTOSO_SEARCH_KEY\"]\n", | ||
"index_name = \"contoso-manuals-index\"\n", | ||
"\n", | ||
"os.environ[\"OPENAI_API_TYPE\"] = \"azure\"\n", | ||
"os.environ[\"OPENAI_API_BASE\"] = os.environ[\"CONTOSO_AI_SERVICES_ENDPOINT\"]\n", | ||
"os.environ[\"OPENAI_API_KEY\"] = os.environ[\"CONTOSO_AI_SERVICES_KEY\"]\n", | ||
"openai_deployment = \"text-embedding-ada-002\"\n", | ||
"\n", | ||
"path_to_data = \"./manuals\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Set up environment variables for cog search SDK\n", | ||
"os.environ[\"AZURE_AI_SEARCH_ENDPOINT\"] = contoso_search\n", | ||
"os.environ[\"AZURE_AI_SEARCH_KEY\"] = contoso_search_key\n", | ||
"\n", | ||
"\n", | ||
"client = AIClient.from_config(DefaultAzureCredential())\n", | ||
"\n", | ||
"# Use the same index name when registering the index in AI Studio\n", | ||
"index = build_index(\n", | ||
" output_index_name=index_name,\n", | ||
" vector_store=\"azure_cognitive_search\",\n", | ||
" embeddings_model=f\"azure_open_ai://deployment/{openai_deployment}/model/{openai_deployment}\",\n", | ||
" data_source_url=\"/products\",\n", | ||
" index_input_config=LocalSource(input_data=path_to_data),\n", | ||
" acs_config=ACSOutputConfig(\n", | ||
" acs_index_name=index_name,\n", | ||
" ),\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# register the index so that it shows up in the project\n", | ||
"cloud_index = client.indexes.create_or_update(index)\n", | ||
"\n", | ||
"print(f\"Created index '{cloud_index.name}'\")\n", | ||
"print(f\"Local Path: {index.path}\")\n", | ||
"print(f\"Cloud Path: {cloud_index.path}\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip uninstall azure-ai-generative[evaluate,index,promptflow]==1.0.0b3 -y" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install azure-search-documents==11.4.0" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.