Skip to content

Commit

Permalink
update notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
jgbradley1 committed Jun 5, 2024
1 parent 49389e7 commit e3f2a0e
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions notebooks/HelloWorld.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,10 @@
" batch_size=100,\n",
" overwrite=True,\n",
")\n",
"print(response)"
"if not response.ok:\n",
" print(response.text)\n",
"else:\n",
" print(response)"
]
},
{
Expand Down Expand Up @@ -751,7 +754,7 @@
" storage_name=storage_name,\n",
" index_name=index_name,\n",
" entity_config_name=entity_configuration_name\n",
" if \"entity_configuration_name\" in locals()\n",
" if \"entity_configuration_name\" in locals() and entity_configuration_name\n",
" else None,\n",
")\n",
"print(response)\n",
Expand Down Expand Up @@ -827,7 +830,7 @@
"metadata": {},
"outputs": [],
"source": [
"# # uncomment this cell to delete entity configuration\n",
"# # uncomment this cell to delete an index\n",
"# response = delete_index(index_name)\n",
"# print(response)\n",
"# pprint(response.json())"
Expand Down Expand Up @@ -950,8 +953,8 @@
},
"outputs": [],
"source": [
"report = get_report(index_name, 0)\n",
"print(report.json()[\"text\"]) if report.ok else (report.reason, report.content)"
"report_response = get_report(index_name, 0)\n",
"print(report_response.json()[\"text\"]) if report_response.ok else (report_response.reason, report_response.content)"
]
},
{
Expand All @@ -971,8 +974,8 @@
},
"outputs": [],
"source": [
"entity = get_entity(index_name, 0)\n",
"entity.json() if entity.ok else (entity.reason, entity.content)"
"entity_response = get_entity(index_name, 0)\n",
"entity_response.json() if entity_response.ok else (entity_response.reason, entity_response.content)"
]
},
{
Expand All @@ -994,8 +997,8 @@
},
"outputs": [],
"source": [
"relationship = get_relationship(index_name, 1)\n",
"relationship.json() if relationship.ok else (relationship.reason, relationship.content)"
"relationship_response = get_relationship(index_name, 1)\n",
"relationship_response.json() if relationship_response.ok else (relationship_response.reason, relationship_response.content)"
]
},
{
Expand Down Expand Up @@ -1040,17 +1043,18 @@
},
"outputs": [],
"source": [
"text_unit_id = \"\" ### Get a text unit id from one of previous Source results\n",
"# get a text unit id from one of the previous Source endpoint results (look for 'text_units' in the response)\n",
"text_unit_id = \"\"\n",
"if not text_unit_id:\n",
" raise ValueError(\n",
" \"Must provide a text_unit_id from previous source results. Look for 'text_units' in the response.\"\n",
" )\n",
"text_unit = get_text_unit(index_name, text_unit_id)\n",
"if text_unit.ok:\n",
" print(text_unit.json()[\"text\"])\n",
"text_unit_response = get_text_unit(index_name, text_unit_id)\n",
"if text_unit_response.ok:\n",
" print(text_unit_response.json()[\"text\"])\n",
"else:\n",
" print(text_unit.reason)\n",
" print(text_unit.content)"
" print(text_unit_response.reason)\n",
" print(text_unit_response.content)"
]
},
{
Expand Down Expand Up @@ -1120,7 +1124,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.10.14"
}
},
"nbformat": 4,
Expand Down

0 comments on commit e3f2a0e

Please sign in to comment.