Skip to content

Commit b8204d8

Browse files
szabostevemiguelgrinberg
authored andcommitted
[DOCS] Refines notebook.
1 parent 3f781bb commit b8204d8

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

notebooks/search/07-inference.ipynb

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"- An Elastic deployment with minimum **4GB machine learning node**\n",
2626
" - We'll be using [Elastic Cloud](https://www.elastic.co/guide/en/cloud/current/ec-getting-started.html) for this example (available with a [free trial](https://cloud.elastic.co/registration?utm_source=github&utm_content=elasticsearch-labs-notebook))\n",
2727
" \n",
28-
"- An [OpenAI account](https://openai.com/) is required to use the Inference API with \n",
29-
"the OpenAI service. "
28+
"- A paid [OpenAI account](https://openai.com/) is required to use the Inference API with \n",
29+
"the OpenAI service as the OpenAI free trial API usage is limited. "
3030
]
3131
},
3232
{
@@ -109,16 +109,18 @@
109109
"metadata": {},
110110
"outputs": [],
111111
"source": [
112-
"# Found in the 'Manage Deployment' page\n",
113-
"CLOUD_ID = getpass.getpass('Enter Elastic Cloud ID: ')\n",
112+
"# https://www.elastic.co/search-labs/tutorials/install-elasticsearch/elastic-cloud#finding-your-cloud-id\n",
113+
"ELASTIC_CLOUD_ID = getpass(\"Elastic Cloud ID: \")\n",
114114
"\n",
115-
"# Password for the 'elastic' user generated by Elasticsearch\n",
116-
"ELASTIC_PASSWORD = getpass.getpass('Enter Elastic password: ')\n",
115+
"# https://www.elastic.co/search-labs/tutorials/install-elasticsearch/elastic-cloud#creating-an-api-key\n",
116+
"ELASTIC_API_KEY = getpass(\"Elastic Api Key: \")\n",
117117
"\n",
118118
"# Create the client instance\n",
119119
"client = Elasticsearch(\n",
120-
" cloud_id=CLOUD_ID,\n",
121-
" basic_auth=(\"elastic\", ELASTIC_PASSWORD)\n",
120+
" # For local development\n",
121+
" # hosts=[\"http://localhost:9200\"] \n",
122+
" cloud_id=ELASTIC_CLOUD_ID,\n",
123+
" api_key=ELASTIC_API_KEY,\n",
122124
")"
123125
]
124126
},
@@ -159,7 +161,7 @@
159161
"\n",
160162
"Let's create the inference task by using the [Create inference API](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html).\n",
161163
"\n",
162-
"You'll need an OpenAI API key for this that you can find in your OpenAI account under the [API keys section](https://platform.openai.com/api-keys)."
164+
"You'll need an OpenAI API key for this that you can find in your OpenAI account under the [API keys section](https://platform.openai.com/api-keys). A paid membership is required to complete the steps in this notebook as the OpenAI free trial API usage is limited."
163165
]
164166
},
165167
{
@@ -241,7 +243,7 @@
241243
"source": [
242244
"## Create index\n",
243245
"\n",
244-
"The mapping of the destination index - the index that contains the embeddings that the model will create based on your input text - must be created. The destination index must have a field with the [dense_vector](https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html) field type to index the output of the OpenAI model.\n",
246+
"The mapping of the destination index the index that contains the embeddings that the model will create based on your input text must be created. The destination index must have a field with the [dense_vector](https://www.elastic.co/guide/en/elasticsearch/reference/current/dense-vector.html) field type to index the output of the OpenAI model.\n",
245247
"\n",
246248
"Let's create an index named `openai-movie-embeddings` with the mappings we need."
247249
]
@@ -265,8 +267,7 @@
265267
" \"properties\": {\n",
266268
" \"plot_embedding\": { \n",
267269
" \"type\": \"dense_vector\", \n",
268-
" \"dims\": 1536, \n",
269-
" \"element_type\": \"byte\",\n",
270+
" \"dims\": 1536,\n",
270271
" \"similarity\": \"dot_product\" \n",
271272
" },\n",
272273
" \"plot\": { \n",
@@ -282,9 +283,9 @@
282283
"id": "e9d4bfd2",
283284
"metadata": {},
284285
"source": [
285-
"## Insert Documents (option 1)\n",
286+
"## Insert Documents\n",
286287
"\n",
287-
"Let's insert our example dataset of 12 movies."
288+
"Let's insert our example dataset of 12 movies. You need a paid OpenAI account to complete this step, otherwise the documentation ingest will time out due to the API request rate limits."
288289
]
289290
},
290291
{

0 commit comments

Comments
 (0)