Skip to content

Commit 0c00bae

Browse files
committed
ELASTICSEARCH_URL
1 parent 68a1907 commit 0c00bae

File tree

1 file changed

+6
-6
lines changed
  • supporting-blog-content/context-engineering-mistral-completions

1 file changed

+6
-6
lines changed

supporting-blog-content/context-engineering-mistral-completions/notebook.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"outputs": [],
5858
"source": [
5959
"# Configuration - Update these values with your credentials\n",
60-
"ELASTICSEARCH_HOST = \"https://tralmis-tral-d91b08.es.us-central1.gcp.elastic.cloud:443\"\n",
60+
"ELASTICSEARCH_URL = \"https://tralmis-tral-d91b08.es.us-central1.gcp.elastic.cloud:443\"\n",
6161
"ELASTICSEARCH_API_KEY = \"<your_elasticsearch_api_key_here>\"\n",
6262
"MISTRAL_API_KEY = \"<your_mistral_api_key_here>\"\n",
6363
"\n",
@@ -80,7 +80,7 @@
8080
"outputs": [],
8181
"source": [
8282
"# Initialize Elasticsearch client\n",
83-
"es_client = Elasticsearch(hosts=[ELASTICSEARCH_HOST], api_key=ELASTICSEARCH_API_KEY)"
83+
"es_client = Elasticsearch(hosts=[ELASTICSEARCH_URL], api_key=ELASTICSEARCH_API_KEY)"
8484
]
8585
},
8686
{
@@ -101,7 +101,7 @@
101101
"outputs": [],
102102
"source": [
103103
"print(\n",
104-
" f\"Creating Mistral inference endpoint: {INFERENCE_ENDPOINT_NAME} at {ELASTICSEARCH_HOST}\"\n",
104+
" f\"Creating Mistral inference endpoint: {INFERENCE_ENDPOINT_NAME} at {ELASTICSEARCH_URL}\"\n",
105105
")\n",
106106
"\n",
107107
"try:\n",
@@ -227,7 +227,7 @@
227227
"print(\"Assistant: \\n\")\n",
228228
"\n",
229229
"for chunk in stream_chat_completion(\n",
230-
" ELASTICSEARCH_HOST, INFERENCE_ENDPOINT_NAME, messages\n",
230+
" ELASTICSEARCH_URL, INFERENCE_ENDPOINT_NAME, messages\n",
231231
"):\n",
232232
" print(chunk, end=\"\", flush=True)"
233233
]
@@ -311,7 +311,7 @@
311311
" for game_doc in games_batch:\n",
312312
" index_meta = {\"index\": {\"_index\": INDEX_NAME, \"_id\": game_doc[\"id\"]}}\n",
313313
" bulk_body += json.dumps(index_meta) + \"\\n\" + json.dumps(game_doc) + \"\\n\"\n",
314-
" bulk_url = f\"{ELASTICSEARCH_HOST}/_bulk\"\n",
314+
" bulk_url = f\"{ELASTICSEARCH_URL}/_bulk\"\n",
315315
" bulk_headers = {**ELASTICSEARCH_HEADERS, \"Content-Type\": \"application/x-ndjson\"}\n",
316316
" try:\n",
317317
" response = requests.post(bulk_url, data=bulk_body, headers=bulk_headers)\n",
@@ -479,7 +479,7 @@
479479
"\n",
480480
" full_response = \"\"\n",
481481
" for chunk in stream_chat_completion(\n",
482-
" ELASTICSEARCH_HOST, INFERENCE_ENDPOINT_NAME, messages\n",
482+
" ELASTICSEARCH_URL, INFERENCE_ENDPOINT_NAME, messages\n",
483483
" ):\n",
484484
" print(chunk, end=\"\", flush=True)\n",
485485
" full_response += chunk\n",

0 commit comments

Comments
 (0)