Skip to content

Commit ba57b11

Browse files
committed
run pre-commit
1 parent 1b1ac85 commit ba57b11

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

notebooks/alibabacloud-ai-search/inference-alibabacloud-ai-search.ipynb

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@
8787
"\n",
8888
"ELASTIC_PASSWORD = getpass(\"ELASTIC PASSWORD: \")\n",
8989
"\n",
90-
"# e.g. \n",
90+
"# e.g.\n",
9191
"# hosts = \"http://es-xxx.elasticsearch.aliyuncs.com:9200\"\n",
92-
"hosts=getpass(\"Host: \")\n",
92+
"hosts = getpass(\"Host: \")\n",
9393
"\n",
9494
"# Create the client instance\n",
9595
"client = Elasticsearch(\n",
9696
" # For local development\n",
9797
" # hosts=[\"http://localhost:9200\"]\n",
9898
" hosts,\n",
99-
" basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD)\n",
99+
" basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD),\n",
100100
")"
101101
]
102102
},
@@ -146,12 +146,12 @@
146146
"API_KEY = getpass(\"Enter AlibabaCloud AI Search API key: \")\n",
147147
"\n",
148148
"# Please enter your AlibabaCloud AI Search host here\n",
149-
"# e.g. \n",
149+
"# e.g.\n",
150150
"# HOST = \"default-xxx.opensearch.aliyuncs.com\"\n",
151151
"HOST = \"\"\n",
152152
"\n",
153153
"# Please enter your AlibabaCloud AI Search workspace name here\n",
154-
"# e.g. \n",
154+
"# e.g.\n",
155155
"# WORKSPACE = \"default\"\n",
156156
"WORKSPACE = \"\"\n",
157157
"\n",
@@ -163,9 +163,9 @@
163163
" \"service_settings\": {\n",
164164
" \"api_key\": API_KEY,\n",
165165
" \"service_id\": \"ops-text-embedding-001\",\n",
166-
" \"host\" : HOST,\n",
167-
" \"workspace\" : WORKSPACE\n",
168-
" }\n",
166+
" \"host\": HOST,\n",
167+
" \"workspace\": WORKSPACE,\n",
168+
" },\n",
169169
" },\n",
170170
")\n",
171171
"\n",
@@ -177,9 +177,9 @@
177177
" \"service_settings\": {\n",
178178
" \"api_key\": API_KEY,\n",
179179
" \"service_id\": \"ops-text-sparse-embedding-001\",\n",
180-
" \"host\" : HOST,\n",
181-
" \"workspace\" : WORKSPACE\n",
182-
" }\n",
180+
" \"host\": HOST,\n",
181+
" \"workspace\": WORKSPACE,\n",
182+
" },\n",
183183
" },\n",
184184
")"
185185
]
@@ -231,7 +231,7 @@
231231
" \"output_field\": \"plot_sparse_embedding\",\n",
232232
" },\n",
233233
" }\n",
234-
" }\n",
234+
" },\n",
235235
" ],\n",
236236
")"
237237
]
@@ -277,21 +277,17 @@
277277
}
278278
],
279279
"source": [
280-
"client.indices.delete(index=\"alibaba-text-embeddings-notebook-test\", ignore_unavailable=True)\n",
280+
"client.indices.delete(\n",
281+
" index=\"alibaba-text-embeddings-notebook-test\", ignore_unavailable=True\n",
282+
")\n",
281283
"client.indices.create(\n",
282284
" index=\"alibaba-text-embeddings-notebook-test\",\n",
283285
" settings={\"index\": {\"default_pipeline\": \"alibaba-embeddings-notebook-test\"}},\n",
284286
" mappings={\n",
285287
" \"properties\": {\n",
286288
" \"plot\": {\"type\": \"text\"},\n",
287-
" \"plot_embedding\": {\n",
288-
" \"type\": \"dense_vector\",\n",
289-
" \"dims\": 1536,\n",
290-
" \"index\": \"true\"\n",
291-
" },\n",
292-
" \"plot_sparse_embedding\": {\n",
293-
" \"type\":\"sparse_vector\"\n",
294-
" }\n",
289+
" \"plot_embedding\": {\"type\": \"dense_vector\", \"dims\": 1536, \"index\": \"true\"},\n",
290+
" \"plot_sparse_embedding\": {\"type\": \"sparse_vector\"},\n",
295291
" }\n",
296292
" },\n",
297293
")"
@@ -437,10 +433,10 @@
437433
" query={\n",
438434
" \"sparse_vector\": {\n",
439435
" \"field\": \"plot_sparse_embedding\",\n",
440-
" \"inference_id\":\"os-sparse-embeddings-notebook-test\",\n",
441-
" \"query\":\"crime dynasty\"\n",
436+
" \"inference_id\": \"os-sparse-embeddings-notebook-test\",\n",
437+
" \"query\": \"crime dynasty\",\n",
442438
" }\n",
443-
" }\n",
439+
" },\n",
444440
")\n",
445441
"\n",
446442
"for hit in response[\"hits\"][\"hits\"]:\n",

0 commit comments

Comments
 (0)