Skip to content

Commit 20dc5a4

Browse files
author
Andrey Vykhodtsev
committed
notebook changes
1 parent 3ce5151 commit 20dc5a4

File tree

4 files changed

+132
-165
lines changed

4 files changed

+132
-165
lines changed

01-Load-Data-ACogSearch.ipynb

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -255,52 +255,52 @@
255255
" }\n",
256256
" ]\n",
257257
" },\n",
258-
" # {\n",
259-
" # \"@odata.type\": \"#Microsoft.Skills.Text.KeyPhraseExtractionSkill\",\n",
260-
" # \"context\": \"/document/pages/*\",\n",
261-
" # \"maxKeyPhraseCount\": 2,\n",
262-
" # \"defaultLanguageCode\": \"en\",\n",
263-
" # \"inputs\": [\n",
264-
" # {\n",
265-
" # \"name\": \"text\", \n",
266-
" # \"source\": \"/document/pages/*\"\n",
267-
" # }\n",
268-
" # ],\n",
269-
" # \"outputs\": [\n",
270-
" # {\n",
271-
" # \"name\": \"keyPhrases\",\n",
272-
" # \"targetName\": \"keyPhrases\"\n",
273-
" # }\n",
274-
" # ]\n",
275-
" # },\n",
276-
" # {\n",
277-
" # \"@odata.type\": \"#Microsoft.Skills.Text.V3.EntityRecognitionSkill\",\n",
278-
" # \"context\": \"/document/pages/*\",\n",
279-
" # \"categories\": [\"Person\", \"URL\", \"Email\"],\n",
280-
" # \"minimumPrecision\": 0.5, \n",
281-
" # \"defaultLanguageCode\": \"en\",\n",
282-
" # \"inputs\": [\n",
283-
" # {\n",
284-
" # \"name\": \"text\", \n",
285-
" # \"source\":\"/document/pages/*\"\n",
286-
" # }\n",
287-
" # ],\n",
288-
" # \"outputs\": [\n",
289-
" # {\n",
290-
" # \"name\": \"persons\", \n",
291-
" # \"targetName\": \"persons\"\n",
292-
" # },\n",
293-
" # {\n",
294-
" # \"name\": \"urls\", \n",
295-
" # \"targetName\": \"urls\"\n",
296-
" # },\n",
297-
" # {\n",
298-
" # \"name\": \"emails\", \n",
299-
" # \"targetName\": \"emails\"\n",
300-
" # }\n",
301-
" # ]\n",
302-
" # }\n",
303-
" # ],\n",
258+
" # {\n",
259+
" # \"@odata.type\": \"#Microsoft.Skills.Text.KeyPhraseExtractionSkill\",\n",
260+
" # \"context\": \"/document/pages/*\",\n",
261+
" # \"maxKeyPhraseCount\": 2,\n",
262+
" # \"defaultLanguageCode\": \"en\",\n",
263+
" # \"inputs\": [\n",
264+
" # {\n",
265+
" # \"name\": \"text\", \n",
266+
" # \"source\": \"/document/pages/*\"\n",
267+
" # }\n",
268+
" # ],\n",
269+
" # \"outputs\": [\n",
270+
" # {\n",
271+
" # \"name\": \"keyPhrases\",\n",
272+
" # \"targetName\": \"keyPhrases\"\n",
273+
" # }\n",
274+
" # ]\n",
275+
" # },\n",
276+
" # {\n",
277+
" # \"@odata.type\": \"#Microsoft.Skills.Text.V3.EntityRecognitionSkill\",\n",
278+
" # \"context\": \"/document/pages/*\",\n",
279+
" # \"categories\": [\"Person\", \"URL\", \"Email\"],\n",
280+
" # \"minimumPrecision\": 0.5, \n",
281+
" # \"defaultLanguageCode\": \"en\",\n",
282+
" # \"inputs\": [\n",
283+
" # {\n",
284+
" # \"name\": \"text\", \n",
285+
" # \"source\":\"/document/pages/*\"\n",
286+
" # }\n",
287+
" # ],\n",
288+
" # \"outputs\": [\n",
289+
" # {\n",
290+
" # \"name\": \"persons\", \n",
291+
" # \"targetName\": \"persons\"\n",
292+
" # },\n",
293+
" # {\n",
294+
" # \"name\": \"urls\", \n",
295+
" # \"targetName\": \"urls\"\n",
296+
" # },\n",
297+
" # {\n",
298+
" # \"name\": \"emails\", \n",
299+
" # \"targetName\": \"emails\"\n",
300+
" # }\n",
301+
" # ]\n",
302+
" # }\n",
303+
" ],\n",
304304
" \"cognitiveServices\": {\n",
305305
" \"@odata.type\": \"#Microsoft.Azure.Search.CognitiveServicesByKey\",\n",
306306
" \"description\": os.environ['COG_SERVICES_NAME'],\n",
@@ -570,10 +570,11 @@
570570
" r = requests.get(os.environ['AZURE_SEARCH_ENDPOINT'] + \"/indexers/\" + indexer_name +\n",
571571
" \"/status\", headers=headers, params=params)\n",
572572
" # pprint(json.dumps(r.json(), indent=1))\n",
573-
" print(r.status_code)\n",
574-
" print(\"Status:\",r.json().get('lastResult').get('status'))\n",
575-
" print(\"Items Processed:\",r.json().get('lastResult').get('itemsProcessed'))\n",
576-
" print(r.ok)\n",
573+
" #print(r.status_code)\n",
574+
" #print(\"Status:\",r.json().get('lastResult').get('status'))\n",
575+
" #print(\"Items Processed:\",r.json().get('lastResult').get('itemsProcessed'))\n",
576+
" #print(r.ok)\n",
577+
" print(r.json().get('lastResult'))\n",
577578
" \n",
578579
"except Exception as e:\n",
579580
" print(\"Wait a few seconds until the process starts and run this cell again.\")"

03-Quering-AOpenAI.ipynb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -772,10 +772,11 @@
772772
"display(HTML('<h4>Top Answers</h4>'))\n",
773773
"\n",
774774
"for index,search_results in agg_search_results.items():\n",
775-
" for result in search_results['@search.answers']:\n",
776-
" if result['score'] > 0.5: # Show answers that are at least 50% of the max possible score=1\n",
777-
" display(HTML('<h5>' + 'Answer - score: ' + str(round(result['score'],2)) + '</h5>'))\n",
778-
" display(HTML(result['text']))\n",
775+
" if '@search_answers' in search_results:\n",
776+
" for result in search_results['@search.answers']:\n",
777+
" if result['score'] > 0.5: # Show answers that are at least 50% of the max possible score=1\n",
778+
" display(HTML('<h5>' + 'Answer - score: ' + str(round(result['score'],2)) + '</h5>'))\n",
779+
" display(HTML(result['text']))\n",
779780
" \n",
780781
"print(\"\\n\\n\")\n",
781782
"display(HTML('<h4>Top Results</h4>'))\n",
@@ -1422,9 +1423,9 @@
14221423
],
14231424
"metadata": {
14241425
"kernelspec": {
1425-
"display_name": "Python 3.10 - SDK v2",
1426+
"display_name": ".venv",
14261427
"language": "python",
1427-
"name": "python310-sdkv2"
1428+
"name": "python3"
14281429
},
14291430
"language_info": {
14301431
"codemirror_mode": {
@@ -1436,7 +1437,7 @@
14361437
"name": "python",
14371438
"nbconvert_exporter": "python",
14381439
"pygments_lexer": "ipython3",
1439-
"version": "3.10.11"
1440+
"version": "3.11.7"
14401441
}
14411442
},
14421443
"nbformat": 4,

0 commit comments

Comments
 (0)