|
57 | 57 | "outputs": [], |
58 | 58 | "source": [ |
59 | 59 | "# 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", |
61 | 61 | "ELASTICSEARCH_API_KEY = \"<your_elasticsearch_api_key_here>\"\n", |
62 | 62 | "MISTRAL_API_KEY = \"<your_mistral_api_key_here>\"\n", |
63 | 63 | "\n", |
|
80 | 80 | "outputs": [], |
81 | 81 | "source": [ |
82 | 82 | "# 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)" |
84 | 84 | ] |
85 | 85 | }, |
86 | 86 | { |
|
101 | 101 | "outputs": [], |
102 | 102 | "source": [ |
103 | 103 | "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", |
105 | 105 | ")\n", |
106 | 106 | "\n", |
107 | 107 | "try:\n", |
|
227 | 227 | "print(\"Assistant: \\n\")\n", |
228 | 228 | "\n", |
229 | 229 | "for chunk in stream_chat_completion(\n", |
230 | | - " ELASTICSEARCH_HOST, INFERENCE_ENDPOINT_NAME, messages\n", |
| 230 | + " ELASTICSEARCH_URL, INFERENCE_ENDPOINT_NAME, messages\n", |
231 | 231 | "):\n", |
232 | 232 | " print(chunk, end=\"\", flush=True)" |
233 | 233 | ] |
|
311 | 311 | " for game_doc in games_batch:\n", |
312 | 312 | " index_meta = {\"index\": {\"_index\": INDEX_NAME, \"_id\": game_doc[\"id\"]}}\n", |
313 | 313 | " 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", |
315 | 315 | " bulk_headers = {**ELASTICSEARCH_HEADERS, \"Content-Type\": \"application/x-ndjson\"}\n", |
316 | 316 | " try:\n", |
317 | 317 | " response = requests.post(bulk_url, data=bulk_body, headers=bulk_headers)\n", |
|
479 | 479 | "\n", |
480 | 480 | " full_response = \"\"\n", |
481 | 481 | " for chunk in stream_chat_completion(\n", |
482 | | - " ELASTICSEARCH_HOST, INFERENCE_ENDPOINT_NAME, messages\n", |
| 482 | + " ELASTICSEARCH_URL, INFERENCE_ENDPOINT_NAME, messages\n", |
483 | 483 | " ):\n", |
484 | 484 | " print(chunk, end=\"\", flush=True)\n", |
485 | 485 | " full_response += chunk\n", |
|
0 commit comments