elasticsearch 9.1.1__py3-none-any.whl → 9.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elasticsearch/_async/client/__init__.py +96 -44
- elasticsearch/_async/client/async_search.py +7 -0
- elasticsearch/_async/client/cat.py +489 -26
- elasticsearch/_async/client/cluster.py +9 -8
- elasticsearch/_async/client/connector.py +3 -3
- elasticsearch/_async/client/eql.py +7 -0
- elasticsearch/_async/client/esql.py +26 -3
- elasticsearch/_async/client/fleet.py +1 -5
- elasticsearch/_async/client/graph.py +1 -5
- elasticsearch/_async/client/ilm.py +2 -10
- elasticsearch/_async/client/indices.py +181 -37
- elasticsearch/_async/client/inference.py +291 -124
- elasticsearch/_async/client/ingest.py +8 -0
- elasticsearch/_async/client/license.py +4 -2
- elasticsearch/_async/client/logstash.py +3 -1
- elasticsearch/_async/client/ml.py +2 -2
- elasticsearch/_async/client/nodes.py +3 -5
- elasticsearch/_async/client/project.py +67 -0
- elasticsearch/_async/client/security.py +39 -0
- elasticsearch/_async/client/shutdown.py +5 -15
- elasticsearch/_async/client/simulate.py +8 -0
- elasticsearch/_async/client/slm.py +1 -5
- elasticsearch/_async/client/snapshot.py +20 -10
- elasticsearch/_async/client/sql.py +7 -0
- elasticsearch/_async/client/streams.py +185 -0
- elasticsearch/_async/client/watcher.py +1 -5
- elasticsearch/_async/helpers.py +74 -12
- elasticsearch/_sync/client/__init__.py +96 -44
- elasticsearch/_sync/client/async_search.py +7 -0
- elasticsearch/_sync/client/cat.py +489 -26
- elasticsearch/_sync/client/cluster.py +9 -8
- elasticsearch/_sync/client/connector.py +3 -3
- elasticsearch/_sync/client/eql.py +7 -0
- elasticsearch/_sync/client/esql.py +26 -3
- elasticsearch/_sync/client/fleet.py +1 -5
- elasticsearch/_sync/client/graph.py +1 -5
- elasticsearch/_sync/client/ilm.py +2 -10
- elasticsearch/_sync/client/indices.py +181 -37
- elasticsearch/_sync/client/inference.py +291 -124
- elasticsearch/_sync/client/ingest.py +8 -0
- elasticsearch/_sync/client/license.py +4 -2
- elasticsearch/_sync/client/logstash.py +3 -1
- elasticsearch/_sync/client/ml.py +2 -2
- elasticsearch/_sync/client/nodes.py +3 -5
- elasticsearch/_sync/client/project.py +67 -0
- elasticsearch/_sync/client/security.py +39 -0
- elasticsearch/_sync/client/shutdown.py +5 -15
- elasticsearch/_sync/client/simulate.py +8 -0
- elasticsearch/_sync/client/slm.py +1 -5
- elasticsearch/_sync/client/snapshot.py +20 -10
- elasticsearch/_sync/client/sql.py +7 -0
- elasticsearch/_sync/client/streams.py +185 -0
- elasticsearch/_sync/client/watcher.py +1 -5
- elasticsearch/_version.py +2 -1
- elasticsearch/client.py +4 -0
- elasticsearch/compat.py +30 -1
- elasticsearch/dsl/__init__.py +28 -0
- elasticsearch/dsl/_async/document.py +2 -1
- elasticsearch/dsl/_sync/document.py +2 -1
- elasticsearch/dsl/aggs.py +97 -0
- elasticsearch/dsl/document_base.py +53 -13
- elasticsearch/dsl/field.py +21 -2
- elasticsearch/dsl/pydantic.py +152 -0
- elasticsearch/dsl/query.py +5 -1
- elasticsearch/dsl/response/__init__.py +3 -0
- elasticsearch/dsl/search_base.py +5 -1
- elasticsearch/dsl/types.py +226 -14
- elasticsearch/esql/esql.py +331 -41
- elasticsearch/esql/functions.py +88 -0
- elasticsearch/helpers/__init__.py +10 -1
- elasticsearch/helpers/actions.py +106 -33
- {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/METADATA +27 -5
- {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/RECORD +76 -71
- {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/WHEEL +0 -0
- {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/LICENSE +0 -0
- {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -78,11 +78,7 @@ class InferenceClient(NamespacedClient):
|
|
|
78
78
|
__body["input"] = input
|
|
79
79
|
if task_settings is not None:
|
|
80
80
|
__body["task_settings"] = task_settings
|
|
81
|
-
|
|
82
|
-
__body = None # type: ignore[assignment]
|
|
83
|
-
__headers = {"accept": "application/json"}
|
|
84
|
-
if __body is not None:
|
|
85
|
-
__headers["content-type"] = "application/json"
|
|
81
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
86
82
|
return self.perform_request( # type: ignore[return-value]
|
|
87
83
|
"POST",
|
|
88
84
|
__path,
|
|
@@ -338,11 +334,7 @@ class InferenceClient(NamespacedClient):
|
|
|
338
334
|
__body["query"] = query
|
|
339
335
|
if task_settings is not None:
|
|
340
336
|
__body["task_settings"] = task_settings
|
|
341
|
-
|
|
342
|
-
__body = None # type: ignore[assignment]
|
|
343
|
-
__headers = {"accept": "application/json"}
|
|
344
|
-
if __body is not None:
|
|
345
|
-
__headers["content-type"] = "application/json"
|
|
337
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
346
338
|
return self.perform_request( # type: ignore[return-value]
|
|
347
339
|
"POST",
|
|
348
340
|
__path,
|
|
@@ -389,11 +381,12 @@ class InferenceClient(NamespacedClient):
|
|
|
389
381
|
However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.</p>
|
|
390
382
|
<p>The following integrations are available through the inference API. You can find the available task types next to the integration name:</p>
|
|
391
383
|
<ul>
|
|
384
|
+
<li>AI21 (<code>chat_completion</code>, <code>completion</code>)</li>
|
|
392
385
|
<li>AlibabaCloud AI Search (<code>completion</code>, <code>rerank</code>, <code>sparse_embedding</code>, <code>text_embedding</code>)</li>
|
|
393
386
|
<li>Amazon Bedrock (<code>completion</code>, <code>text_embedding</code>)</li>
|
|
394
387
|
<li>Amazon SageMaker (<code>chat_completion</code>, <code>completion</code>, <code>rerank</code>, <code>sparse_embedding</code>, <code>text_embedding</code>)</li>
|
|
395
388
|
<li>Anthropic (<code>completion</code>)</li>
|
|
396
|
-
<li>Azure AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
|
|
389
|
+
<li>Azure AI Studio (<code>completion</code>, 'rerank', <code>text_embedding</code>)</li>
|
|
397
390
|
<li>Azure OpenAI (<code>completion</code>, <code>text_embedding</code>)</li>
|
|
398
391
|
<li>Cohere (<code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
|
|
399
392
|
<li>DeepSeek (<code>chat_completion</code>, <code>completion</code>)</li>
|
|
@@ -463,6 +456,82 @@ class InferenceClient(NamespacedClient):
|
|
|
463
456
|
path_parts=__path_parts,
|
|
464
457
|
)
|
|
465
458
|
|
|
459
|
+
@_rewrite_parameters(
|
|
460
|
+
body_fields=("service", "service_settings"),
|
|
461
|
+
)
|
|
462
|
+
def put_ai21(
|
|
463
|
+
self,
|
|
464
|
+
*,
|
|
465
|
+
task_type: t.Union[str, t.Literal["chat_completion", "completion"]],
|
|
466
|
+
ai21_inference_id: str,
|
|
467
|
+
service: t.Optional[t.Union[str, t.Literal["ai21"]]] = None,
|
|
468
|
+
service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
469
|
+
error_trace: t.Optional[bool] = None,
|
|
470
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
471
|
+
human: t.Optional[bool] = None,
|
|
472
|
+
pretty: t.Optional[bool] = None,
|
|
473
|
+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
474
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
475
|
+
) -> ObjectApiResponse[t.Any]:
|
|
476
|
+
"""
|
|
477
|
+
.. raw:: html
|
|
478
|
+
|
|
479
|
+
<p>Create a AI21 inference endpoint.</p>
|
|
480
|
+
<p>Create an inference endpoint to perform an inference task with the <code>ai21</code> service.</p>
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-ai21>`_
|
|
484
|
+
|
|
485
|
+
:param task_type: The type of the inference task that the model will perform.
|
|
486
|
+
:param ai21_inference_id: The unique identifier of the inference endpoint.
|
|
487
|
+
:param service: The type of service supported for the specified task type. In
|
|
488
|
+
this case, `ai21`.
|
|
489
|
+
:param service_settings: Settings used to install the inference model. These
|
|
490
|
+
settings are specific to the `ai21` service.
|
|
491
|
+
:param timeout: Specifies the amount of time to wait for the inference endpoint
|
|
492
|
+
to be created.
|
|
493
|
+
"""
|
|
494
|
+
if task_type in SKIP_IN_PATH:
|
|
495
|
+
raise ValueError("Empty value passed for parameter 'task_type'")
|
|
496
|
+
if ai21_inference_id in SKIP_IN_PATH:
|
|
497
|
+
raise ValueError("Empty value passed for parameter 'ai21_inference_id'")
|
|
498
|
+
if service is None and body is None:
|
|
499
|
+
raise ValueError("Empty value passed for parameter 'service'")
|
|
500
|
+
if service_settings is None and body is None:
|
|
501
|
+
raise ValueError("Empty value passed for parameter 'service_settings'")
|
|
502
|
+
__path_parts: t.Dict[str, str] = {
|
|
503
|
+
"task_type": _quote(task_type),
|
|
504
|
+
"ai21_inference_id": _quote(ai21_inference_id),
|
|
505
|
+
}
|
|
506
|
+
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["ai21_inference_id"]}'
|
|
507
|
+
__query: t.Dict[str, t.Any] = {}
|
|
508
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
509
|
+
if error_trace is not None:
|
|
510
|
+
__query["error_trace"] = error_trace
|
|
511
|
+
if filter_path is not None:
|
|
512
|
+
__query["filter_path"] = filter_path
|
|
513
|
+
if human is not None:
|
|
514
|
+
__query["human"] = human
|
|
515
|
+
if pretty is not None:
|
|
516
|
+
__query["pretty"] = pretty
|
|
517
|
+
if timeout is not None:
|
|
518
|
+
__query["timeout"] = timeout
|
|
519
|
+
if not __body:
|
|
520
|
+
if service is not None:
|
|
521
|
+
__body["service"] = service
|
|
522
|
+
if service_settings is not None:
|
|
523
|
+
__body["service_settings"] = service_settings
|
|
524
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
525
|
+
return self.perform_request( # type: ignore[return-value]
|
|
526
|
+
"PUT",
|
|
527
|
+
__path,
|
|
528
|
+
params=__query,
|
|
529
|
+
headers=__headers,
|
|
530
|
+
body=__body,
|
|
531
|
+
endpoint_id="inference.put_ai21",
|
|
532
|
+
path_parts=__path_parts,
|
|
533
|
+
)
|
|
534
|
+
|
|
466
535
|
@_rewrite_parameters(
|
|
467
536
|
body_fields=(
|
|
468
537
|
"service",
|
|
@@ -546,11 +615,7 @@ class InferenceClient(NamespacedClient):
|
|
|
546
615
|
__body["chunking_settings"] = chunking_settings
|
|
547
616
|
if task_settings is not None:
|
|
548
617
|
__body["task_settings"] = task_settings
|
|
549
|
-
|
|
550
|
-
__body = None # type: ignore[assignment]
|
|
551
|
-
__headers = {"accept": "application/json"}
|
|
552
|
-
if __body is not None:
|
|
553
|
-
__headers["content-type"] = "application/json"
|
|
618
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
554
619
|
return self.perform_request( # type: ignore[return-value]
|
|
555
620
|
"PUT",
|
|
556
621
|
__path,
|
|
@@ -646,11 +711,7 @@ class InferenceClient(NamespacedClient):
|
|
|
646
711
|
__body["chunking_settings"] = chunking_settings
|
|
647
712
|
if task_settings is not None:
|
|
648
713
|
__body["task_settings"] = task_settings
|
|
649
|
-
|
|
650
|
-
__body = None # type: ignore[assignment]
|
|
651
|
-
__headers = {"accept": "application/json"}
|
|
652
|
-
if __body is not None:
|
|
653
|
-
__headers["content-type"] = "application/json"
|
|
714
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
654
715
|
return self.perform_request( # type: ignore[return-value]
|
|
655
716
|
"PUT",
|
|
656
717
|
__path,
|
|
@@ -752,11 +813,7 @@ class InferenceClient(NamespacedClient):
|
|
|
752
813
|
__body["chunking_settings"] = chunking_settings
|
|
753
814
|
if task_settings is not None:
|
|
754
815
|
__body["task_settings"] = task_settings
|
|
755
|
-
|
|
756
|
-
__body = None # type: ignore[assignment]
|
|
757
|
-
__headers = {"accept": "application/json"}
|
|
758
|
-
if __body is not None:
|
|
759
|
-
__headers["content-type"] = "application/json"
|
|
816
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
760
817
|
return self.perform_request( # type: ignore[return-value]
|
|
761
818
|
"PUT",
|
|
762
819
|
__path,
|
|
@@ -849,11 +906,7 @@ class InferenceClient(NamespacedClient):
|
|
|
849
906
|
__body["chunking_settings"] = chunking_settings
|
|
850
907
|
if task_settings is not None:
|
|
851
908
|
__body["task_settings"] = task_settings
|
|
852
|
-
|
|
853
|
-
__body = None # type: ignore[assignment]
|
|
854
|
-
__headers = {"accept": "application/json"}
|
|
855
|
-
if __body is not None:
|
|
856
|
-
__headers["content-type"] = "application/json"
|
|
909
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
857
910
|
return self.perform_request( # type: ignore[return-value]
|
|
858
911
|
"PUT",
|
|
859
912
|
__path,
|
|
@@ -875,7 +928,7 @@ class InferenceClient(NamespacedClient):
|
|
|
875
928
|
def put_azureaistudio(
|
|
876
929
|
self,
|
|
877
930
|
*,
|
|
878
|
-
task_type: t.Union[str, t.Literal["completion", "text_embedding"]],
|
|
931
|
+
task_type: t.Union[str, t.Literal["completion", "rerank", "text_embedding"]],
|
|
879
932
|
azureaistudio_inference_id: str,
|
|
880
933
|
service: t.Optional[t.Union[str, t.Literal["azureaistudio"]]] = None,
|
|
881
934
|
service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
@@ -945,11 +998,7 @@ class InferenceClient(NamespacedClient):
|
|
|
945
998
|
__body["chunking_settings"] = chunking_settings
|
|
946
999
|
if task_settings is not None:
|
|
947
1000
|
__body["task_settings"] = task_settings
|
|
948
|
-
|
|
949
|
-
__body = None # type: ignore[assignment]
|
|
950
|
-
__headers = {"accept": "application/json"}
|
|
951
|
-
if __body is not None:
|
|
952
|
-
__headers["content-type"] = "application/json"
|
|
1001
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
953
1002
|
return self.perform_request( # type: ignore[return-value]
|
|
954
1003
|
"PUT",
|
|
955
1004
|
__path,
|
|
@@ -1049,11 +1098,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1049
1098
|
__body["chunking_settings"] = chunking_settings
|
|
1050
1099
|
if task_settings is not None:
|
|
1051
1100
|
__body["task_settings"] = task_settings
|
|
1052
|
-
|
|
1053
|
-
__body = None # type: ignore[assignment]
|
|
1054
|
-
__headers = {"accept": "application/json"}
|
|
1055
|
-
if __body is not None:
|
|
1056
|
-
__headers["content-type"] = "application/json"
|
|
1101
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1057
1102
|
return self.perform_request( # type: ignore[return-value]
|
|
1058
1103
|
"PUT",
|
|
1059
1104
|
__path,
|
|
@@ -1143,11 +1188,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1143
1188
|
__body["chunking_settings"] = chunking_settings
|
|
1144
1189
|
if task_settings is not None:
|
|
1145
1190
|
__body["task_settings"] = task_settings
|
|
1146
|
-
|
|
1147
|
-
__body = None # type: ignore[assignment]
|
|
1148
|
-
__headers = {"accept": "application/json"}
|
|
1149
|
-
if __body is not None:
|
|
1150
|
-
__headers["content-type"] = "application/json"
|
|
1191
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1151
1192
|
return self.perform_request( # type: ignore[return-value]
|
|
1152
1193
|
"PUT",
|
|
1153
1194
|
__path,
|
|
@@ -1158,6 +1199,99 @@ class InferenceClient(NamespacedClient):
|
|
|
1158
1199
|
path_parts=__path_parts,
|
|
1159
1200
|
)
|
|
1160
1201
|
|
|
1202
|
+
@_rewrite_parameters(
|
|
1203
|
+
body_fields=(
|
|
1204
|
+
"service",
|
|
1205
|
+
"service_settings",
|
|
1206
|
+
"chunking_settings",
|
|
1207
|
+
"task_settings",
|
|
1208
|
+
),
|
|
1209
|
+
)
|
|
1210
|
+
def put_contextualai(
|
|
1211
|
+
self,
|
|
1212
|
+
*,
|
|
1213
|
+
task_type: t.Union[str, t.Literal["rerank"]],
|
|
1214
|
+
contextualai_inference_id: str,
|
|
1215
|
+
service: t.Optional[t.Union[str, t.Literal["contextualai"]]] = None,
|
|
1216
|
+
service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
1217
|
+
chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
1218
|
+
error_trace: t.Optional[bool] = None,
|
|
1219
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
1220
|
+
human: t.Optional[bool] = None,
|
|
1221
|
+
pretty: t.Optional[bool] = None,
|
|
1222
|
+
task_settings: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
1223
|
+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
1224
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1225
|
+
) -> ObjectApiResponse[t.Any]:
|
|
1226
|
+
"""
|
|
1227
|
+
.. raw:: html
|
|
1228
|
+
|
|
1229
|
+
<p>Create an Contextual AI inference endpoint.</p>
|
|
1230
|
+
<p>Create an inference endpoint to perform an inference task with the <code>contexualai</code> service.</p>
|
|
1231
|
+
<p>To review the available <code>rerank</code> models, refer to <a href="https://docs.contextual.ai/api-reference/rerank/rerank#body-model">https://docs.contextual.ai/api-reference/rerank/rerank#body-model</a>.</p>
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-contextualai>`_
|
|
1235
|
+
|
|
1236
|
+
:param task_type: The type of the inference task that the model will perform.
|
|
1237
|
+
:param contextualai_inference_id: The unique identifier of the inference endpoint.
|
|
1238
|
+
:param service: The type of service supported for the specified task type. In
|
|
1239
|
+
this case, `contextualai`.
|
|
1240
|
+
:param service_settings: Settings used to install the inference model. These
|
|
1241
|
+
settings are specific to the `contextualai` service.
|
|
1242
|
+
:param chunking_settings: The chunking configuration object.
|
|
1243
|
+
:param task_settings: Settings to configure the inference task. These settings
|
|
1244
|
+
are specific to the task type you specified.
|
|
1245
|
+
:param timeout: Specifies the amount of time to wait for the inference endpoint
|
|
1246
|
+
to be created.
|
|
1247
|
+
"""
|
|
1248
|
+
if task_type in SKIP_IN_PATH:
|
|
1249
|
+
raise ValueError("Empty value passed for parameter 'task_type'")
|
|
1250
|
+
if contextualai_inference_id in SKIP_IN_PATH:
|
|
1251
|
+
raise ValueError(
|
|
1252
|
+
"Empty value passed for parameter 'contextualai_inference_id'"
|
|
1253
|
+
)
|
|
1254
|
+
if service is None and body is None:
|
|
1255
|
+
raise ValueError("Empty value passed for parameter 'service'")
|
|
1256
|
+
if service_settings is None and body is None:
|
|
1257
|
+
raise ValueError("Empty value passed for parameter 'service_settings'")
|
|
1258
|
+
__path_parts: t.Dict[str, str] = {
|
|
1259
|
+
"task_type": _quote(task_type),
|
|
1260
|
+
"contextualai_inference_id": _quote(contextualai_inference_id),
|
|
1261
|
+
}
|
|
1262
|
+
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["contextualai_inference_id"]}'
|
|
1263
|
+
__query: t.Dict[str, t.Any] = {}
|
|
1264
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
1265
|
+
if error_trace is not None:
|
|
1266
|
+
__query["error_trace"] = error_trace
|
|
1267
|
+
if filter_path is not None:
|
|
1268
|
+
__query["filter_path"] = filter_path
|
|
1269
|
+
if human is not None:
|
|
1270
|
+
__query["human"] = human
|
|
1271
|
+
if pretty is not None:
|
|
1272
|
+
__query["pretty"] = pretty
|
|
1273
|
+
if timeout is not None:
|
|
1274
|
+
__query["timeout"] = timeout
|
|
1275
|
+
if not __body:
|
|
1276
|
+
if service is not None:
|
|
1277
|
+
__body["service"] = service
|
|
1278
|
+
if service_settings is not None:
|
|
1279
|
+
__body["service_settings"] = service_settings
|
|
1280
|
+
if chunking_settings is not None:
|
|
1281
|
+
__body["chunking_settings"] = chunking_settings
|
|
1282
|
+
if task_settings is not None:
|
|
1283
|
+
__body["task_settings"] = task_settings
|
|
1284
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1285
|
+
return self.perform_request( # type: ignore[return-value]
|
|
1286
|
+
"PUT",
|
|
1287
|
+
__path,
|
|
1288
|
+
params=__query,
|
|
1289
|
+
headers=__headers,
|
|
1290
|
+
body=__body,
|
|
1291
|
+
endpoint_id="inference.put_contextualai",
|
|
1292
|
+
path_parts=__path_parts,
|
|
1293
|
+
)
|
|
1294
|
+
|
|
1161
1295
|
@_rewrite_parameters(
|
|
1162
1296
|
body_fields=(
|
|
1163
1297
|
"service",
|
|
@@ -1274,11 +1408,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1274
1408
|
__body["chunking_settings"] = chunking_settings
|
|
1275
1409
|
if task_settings is not None:
|
|
1276
1410
|
__body["task_settings"] = task_settings
|
|
1277
|
-
|
|
1278
|
-
__body = None # type: ignore[assignment]
|
|
1279
|
-
__headers = {"accept": "application/json"}
|
|
1280
|
-
if __body is not None:
|
|
1281
|
-
__headers["content-type"] = "application/json"
|
|
1411
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1282
1412
|
return self.perform_request( # type: ignore[return-value]
|
|
1283
1413
|
"PUT",
|
|
1284
1414
|
__path,
|
|
@@ -1358,11 +1488,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1358
1488
|
__body["service_settings"] = service_settings
|
|
1359
1489
|
if chunking_settings is not None:
|
|
1360
1490
|
__body["chunking_settings"] = chunking_settings
|
|
1361
|
-
|
|
1362
|
-
__body = None # type: ignore[assignment]
|
|
1363
|
-
__headers = {"accept": "application/json"}
|
|
1364
|
-
if __body is not None:
|
|
1365
|
-
__headers["content-type"] = "application/json"
|
|
1491
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1366
1492
|
return self.perform_request( # type: ignore[return-value]
|
|
1367
1493
|
"PUT",
|
|
1368
1494
|
__path,
|
|
@@ -1470,11 +1596,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1470
1596
|
__body["chunking_settings"] = chunking_settings
|
|
1471
1597
|
if task_settings is not None:
|
|
1472
1598
|
__body["task_settings"] = task_settings
|
|
1473
|
-
|
|
1474
|
-
__body = None # type: ignore[assignment]
|
|
1475
|
-
__headers = {"accept": "application/json"}
|
|
1476
|
-
if __body is not None:
|
|
1477
|
-
__headers["content-type"] = "application/json"
|
|
1599
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1478
1600
|
return self.perform_request( # type: ignore[return-value]
|
|
1479
1601
|
"PUT",
|
|
1480
1602
|
__path,
|
|
@@ -1532,7 +1654,8 @@ class InferenceClient(NamespacedClient):
|
|
|
1532
1654
|
this case, `elser`.
|
|
1533
1655
|
:param service_settings: Settings used to install the inference model. These
|
|
1534
1656
|
settings are specific to the `elser` service.
|
|
1535
|
-
:param chunking_settings: The chunking configuration object.
|
|
1657
|
+
:param chunking_settings: The chunking configuration object. Note that for ELSER
|
|
1658
|
+
endpoints, the max_chunk_size may not exceed `300`.
|
|
1536
1659
|
:param timeout: Specifies the amount of time to wait for the inference endpoint
|
|
1537
1660
|
to be created.
|
|
1538
1661
|
"""
|
|
@@ -1568,11 +1691,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1568
1691
|
__body["service_settings"] = service_settings
|
|
1569
1692
|
if chunking_settings is not None:
|
|
1570
1693
|
__body["chunking_settings"] = chunking_settings
|
|
1571
|
-
|
|
1572
|
-
__body = None # type: ignore[assignment]
|
|
1573
|
-
__headers = {"accept": "application/json"}
|
|
1574
|
-
if __body is not None:
|
|
1575
|
-
__headers["content-type"] = "application/json"
|
|
1694
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1576
1695
|
return self.perform_request( # type: ignore[return-value]
|
|
1577
1696
|
"PUT",
|
|
1578
1697
|
__path,
|
|
@@ -1654,11 +1773,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1654
1773
|
__body["service_settings"] = service_settings
|
|
1655
1774
|
if chunking_settings is not None:
|
|
1656
1775
|
__body["chunking_settings"] = chunking_settings
|
|
1657
|
-
|
|
1658
|
-
__body = None # type: ignore[assignment]
|
|
1659
|
-
__headers = {"accept": "application/json"}
|
|
1660
|
-
if __body is not None:
|
|
1661
|
-
__headers["content-type"] = "application/json"
|
|
1776
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1662
1777
|
return self.perform_request( # type: ignore[return-value]
|
|
1663
1778
|
"PUT",
|
|
1664
1779
|
__path,
|
|
@@ -1752,11 +1867,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1752
1867
|
__body["chunking_settings"] = chunking_settings
|
|
1753
1868
|
if task_settings is not None:
|
|
1754
1869
|
__body["task_settings"] = task_settings
|
|
1755
|
-
|
|
1756
|
-
__body = None # type: ignore[assignment]
|
|
1757
|
-
__headers = {"accept": "application/json"}
|
|
1758
|
-
if __body is not None:
|
|
1759
|
-
__headers["content-type"] = "application/json"
|
|
1870
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1760
1871
|
return self.perform_request( # type: ignore[return-value]
|
|
1761
1872
|
"PUT",
|
|
1762
1873
|
__path,
|
|
@@ -1884,11 +1995,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1884
1995
|
__body["chunking_settings"] = chunking_settings
|
|
1885
1996
|
if task_settings is not None:
|
|
1886
1997
|
__body["task_settings"] = task_settings
|
|
1887
|
-
|
|
1888
|
-
__body = None # type: ignore[assignment]
|
|
1889
|
-
__headers = {"accept": "application/json"}
|
|
1890
|
-
if __body is not None:
|
|
1891
|
-
__headers["content-type"] = "application/json"
|
|
1998
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1892
1999
|
return self.perform_request( # type: ignore[return-value]
|
|
1893
2000
|
"PUT",
|
|
1894
2001
|
__path,
|
|
@@ -1980,11 +2087,7 @@ class InferenceClient(NamespacedClient):
|
|
|
1980
2087
|
__body["chunking_settings"] = chunking_settings
|
|
1981
2088
|
if task_settings is not None:
|
|
1982
2089
|
__body["task_settings"] = task_settings
|
|
1983
|
-
|
|
1984
|
-
__body = None # type: ignore[assignment]
|
|
1985
|
-
__headers = {"accept": "application/json"}
|
|
1986
|
-
if __body is not None:
|
|
1987
|
-
__headers["content-type"] = "application/json"
|
|
2090
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
1988
2091
|
return self.perform_request( # type: ignore[return-value]
|
|
1989
2092
|
"PUT",
|
|
1990
2093
|
__path,
|
|
@@ -1995,6 +2098,88 @@ class InferenceClient(NamespacedClient):
|
|
|
1995
2098
|
path_parts=__path_parts,
|
|
1996
2099
|
)
|
|
1997
2100
|
|
|
2101
|
+
@_rewrite_parameters(
|
|
2102
|
+
body_fields=("service", "service_settings", "chunking_settings"),
|
|
2103
|
+
)
|
|
2104
|
+
def put_llama(
|
|
2105
|
+
self,
|
|
2106
|
+
*,
|
|
2107
|
+
task_type: t.Union[
|
|
2108
|
+
str, t.Literal["chat_completion", "completion", "text_embedding"]
|
|
2109
|
+
],
|
|
2110
|
+
llama_inference_id: str,
|
|
2111
|
+
service: t.Optional[t.Union[str, t.Literal["llama"]]] = None,
|
|
2112
|
+
service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2113
|
+
chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2114
|
+
error_trace: t.Optional[bool] = None,
|
|
2115
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2116
|
+
human: t.Optional[bool] = None,
|
|
2117
|
+
pretty: t.Optional[bool] = None,
|
|
2118
|
+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
2119
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2120
|
+
) -> ObjectApiResponse[t.Any]:
|
|
2121
|
+
"""
|
|
2122
|
+
.. raw:: html
|
|
2123
|
+
|
|
2124
|
+
<p>Create a Llama inference endpoint.</p>
|
|
2125
|
+
<p>Create an inference endpoint to perform an inference task with the <code>llama</code> service.</p>
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-llama>`_
|
|
2129
|
+
|
|
2130
|
+
:param task_type: The type of the inference task that the model will perform.
|
|
2131
|
+
:param llama_inference_id: The unique identifier of the inference endpoint.
|
|
2132
|
+
:param service: The type of service supported for the specified task type. In
|
|
2133
|
+
this case, `llama`.
|
|
2134
|
+
:param service_settings: Settings used to install the inference model. These
|
|
2135
|
+
settings are specific to the `llama` service.
|
|
2136
|
+
:param chunking_settings: The chunking configuration object.
|
|
2137
|
+
:param timeout: Specifies the amount of time to wait for the inference endpoint
|
|
2138
|
+
to be created.
|
|
2139
|
+
"""
|
|
2140
|
+
if task_type in SKIP_IN_PATH:
|
|
2141
|
+
raise ValueError("Empty value passed for parameter 'task_type'")
|
|
2142
|
+
if llama_inference_id in SKIP_IN_PATH:
|
|
2143
|
+
raise ValueError("Empty value passed for parameter 'llama_inference_id'")
|
|
2144
|
+
if service is None and body is None:
|
|
2145
|
+
raise ValueError("Empty value passed for parameter 'service'")
|
|
2146
|
+
if service_settings is None and body is None:
|
|
2147
|
+
raise ValueError("Empty value passed for parameter 'service_settings'")
|
|
2148
|
+
__path_parts: t.Dict[str, str] = {
|
|
2149
|
+
"task_type": _quote(task_type),
|
|
2150
|
+
"llama_inference_id": _quote(llama_inference_id),
|
|
2151
|
+
}
|
|
2152
|
+
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["llama_inference_id"]}'
|
|
2153
|
+
__query: t.Dict[str, t.Any] = {}
|
|
2154
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2155
|
+
if error_trace is not None:
|
|
2156
|
+
__query["error_trace"] = error_trace
|
|
2157
|
+
if filter_path is not None:
|
|
2158
|
+
__query["filter_path"] = filter_path
|
|
2159
|
+
if human is not None:
|
|
2160
|
+
__query["human"] = human
|
|
2161
|
+
if pretty is not None:
|
|
2162
|
+
__query["pretty"] = pretty
|
|
2163
|
+
if timeout is not None:
|
|
2164
|
+
__query["timeout"] = timeout
|
|
2165
|
+
if not __body:
|
|
2166
|
+
if service is not None:
|
|
2167
|
+
__body["service"] = service
|
|
2168
|
+
if service_settings is not None:
|
|
2169
|
+
__body["service_settings"] = service_settings
|
|
2170
|
+
if chunking_settings is not None:
|
|
2171
|
+
__body["chunking_settings"] = chunking_settings
|
|
2172
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2173
|
+
return self.perform_request( # type: ignore[return-value]
|
|
2174
|
+
"PUT",
|
|
2175
|
+
__path,
|
|
2176
|
+
params=__query,
|
|
2177
|
+
headers=__headers,
|
|
2178
|
+
body=__body,
|
|
2179
|
+
endpoint_id="inference.put_llama",
|
|
2180
|
+
path_parts=__path_parts,
|
|
2181
|
+
)
|
|
2182
|
+
|
|
1998
2183
|
@_rewrite_parameters(
|
|
1999
2184
|
body_fields=("service", "service_settings", "chunking_settings"),
|
|
2000
2185
|
)
|
|
@@ -2066,11 +2251,7 @@ class InferenceClient(NamespacedClient):
|
|
|
2066
2251
|
__body["service_settings"] = service_settings
|
|
2067
2252
|
if chunking_settings is not None:
|
|
2068
2253
|
__body["chunking_settings"] = chunking_settings
|
|
2069
|
-
|
|
2070
|
-
__body = None # type: ignore[assignment]
|
|
2071
|
-
__headers = {"accept": "application/json"}
|
|
2072
|
-
if __body is not None:
|
|
2073
|
-
__headers["content-type"] = "application/json"
|
|
2254
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2074
2255
|
return self.perform_request( # type: ignore[return-value]
|
|
2075
2256
|
"PUT",
|
|
2076
2257
|
__path,
|
|
@@ -2164,11 +2345,7 @@ class InferenceClient(NamespacedClient):
|
|
|
2164
2345
|
__body["chunking_settings"] = chunking_settings
|
|
2165
2346
|
if task_settings is not None:
|
|
2166
2347
|
__body["task_settings"] = task_settings
|
|
2167
|
-
|
|
2168
|
-
__body = None # type: ignore[assignment]
|
|
2169
|
-
__headers = {"accept": "application/json"}
|
|
2170
|
-
if __body is not None:
|
|
2171
|
-
__headers["content-type"] = "application/json"
|
|
2348
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2172
2349
|
return self.perform_request( # type: ignore[return-value]
|
|
2173
2350
|
"PUT",
|
|
2174
2351
|
__path,
|
|
@@ -2259,11 +2436,7 @@ class InferenceClient(NamespacedClient):
|
|
|
2259
2436
|
__body["chunking_settings"] = chunking_settings
|
|
2260
2437
|
if task_settings is not None:
|
|
2261
2438
|
__body["task_settings"] = task_settings
|
|
2262
|
-
|
|
2263
|
-
__body = None # type: ignore[assignment]
|
|
2264
|
-
__headers = {"accept": "application/json"}
|
|
2265
|
-
if __body is not None:
|
|
2266
|
-
__headers["content-type"] = "application/json"
|
|
2439
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2267
2440
|
return self.perform_request( # type: ignore[return-value]
|
|
2268
2441
|
"PUT",
|
|
2269
2442
|
__path,
|
|
@@ -2343,11 +2516,7 @@ class InferenceClient(NamespacedClient):
|
|
|
2343
2516
|
__body["service"] = service
|
|
2344
2517
|
if service_settings is not None:
|
|
2345
2518
|
__body["service_settings"] = service_settings
|
|
2346
|
-
|
|
2347
|
-
__body = None # type: ignore[assignment]
|
|
2348
|
-
__headers = {"accept": "application/json"}
|
|
2349
|
-
if __body is not None:
|
|
2350
|
-
__headers["content-type"] = "application/json"
|
|
2519
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2351
2520
|
return self.perform_request( # type: ignore[return-value]
|
|
2352
2521
|
"PUT",
|
|
2353
2522
|
__path,
|
|
@@ -2420,11 +2589,7 @@ class InferenceClient(NamespacedClient):
|
|
|
2420
2589
|
__body["query"] = query
|
|
2421
2590
|
if task_settings is not None:
|
|
2422
2591
|
__body["task_settings"] = task_settings
|
|
2423
|
-
|
|
2424
|
-
__body = None # type: ignore[assignment]
|
|
2425
|
-
__headers = {"accept": "application/json"}
|
|
2426
|
-
if __body is not None:
|
|
2427
|
-
__headers["content-type"] = "application/json"
|
|
2592
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2428
2593
|
return self.perform_request( # type: ignore[return-value]
|
|
2429
2594
|
"POST",
|
|
2430
2595
|
__path,
|
|
@@ -2488,11 +2653,7 @@ class InferenceClient(NamespacedClient):
|
|
|
2488
2653
|
__body["input"] = input
|
|
2489
2654
|
if task_settings is not None:
|
|
2490
2655
|
__body["task_settings"] = task_settings
|
|
2491
|
-
|
|
2492
|
-
__body = None # type: ignore[assignment]
|
|
2493
|
-
__headers = {"accept": "application/json"}
|
|
2494
|
-
if __body is not None:
|
|
2495
|
-
__headers["content-type"] = "application/json"
|
|
2656
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2496
2657
|
return self.perform_request( # type: ignore[return-value]
|
|
2497
2658
|
"POST",
|
|
2498
2659
|
__path,
|
|
@@ -2504,7 +2665,7 @@ class InferenceClient(NamespacedClient):
|
|
|
2504
2665
|
)
|
|
2505
2666
|
|
|
2506
2667
|
@_rewrite_parameters(
|
|
2507
|
-
body_fields=("input", "task_settings"),
|
|
2668
|
+
body_fields=("input", "input_type", "task_settings"),
|
|
2508
2669
|
)
|
|
2509
2670
|
def text_embedding(
|
|
2510
2671
|
self,
|
|
@@ -2514,6 +2675,7 @@ class InferenceClient(NamespacedClient):
|
|
|
2514
2675
|
error_trace: t.Optional[bool] = None,
|
|
2515
2676
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2516
2677
|
human: t.Optional[bool] = None,
|
|
2678
|
+
input_type: t.Optional[str] = None,
|
|
2517
2679
|
pretty: t.Optional[bool] = None,
|
|
2518
2680
|
task_settings: t.Optional[t.Any] = None,
|
|
2519
2681
|
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
@@ -2529,6 +2691,13 @@ class InferenceClient(NamespacedClient):
|
|
|
2529
2691
|
|
|
2530
2692
|
:param inference_id: The inference Id
|
|
2531
2693
|
:param input: Inference input. Either a string or an array of strings.
|
|
2694
|
+
:param input_type: The input data type for the text embedding model. Possible
|
|
2695
|
+
values include: * `SEARCH` * `INGEST` * `CLASSIFICATION` * `CLUSTERING` Not
|
|
2696
|
+
all services support all values. Unsupported values will trigger a validation
|
|
2697
|
+
exception. Accepted values depend on the configured inference service, refer
|
|
2698
|
+
to the relevant service-specific documentation for more info. > info > The
|
|
2699
|
+
`input_type` parameter specified on the root level of the request body will
|
|
2700
|
+
take precedence over the `input_type` parameter specified in `task_settings`.
|
|
2532
2701
|
:param task_settings: Optional task settings
|
|
2533
2702
|
:param timeout: Specifies the amount of time to wait for the inference request
|
|
2534
2703
|
to complete.
|
|
@@ -2554,13 +2723,11 @@ class InferenceClient(NamespacedClient):
|
|
|
2554
2723
|
if not __body:
|
|
2555
2724
|
if input is not None:
|
|
2556
2725
|
__body["input"] = input
|
|
2726
|
+
if input_type is not None:
|
|
2727
|
+
__body["input_type"] = input_type
|
|
2557
2728
|
if task_settings is not None:
|
|
2558
2729
|
__body["task_settings"] = task_settings
|
|
2559
|
-
|
|
2560
|
-
__body = None # type: ignore[assignment]
|
|
2561
|
-
__headers = {"accept": "application/json"}
|
|
2562
|
-
if __body is not None:
|
|
2563
|
-
__headers["content-type"] = "application/json"
|
|
2730
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2564
2731
|
return self.perform_request( # type: ignore[return-value]
|
|
2565
2732
|
"POST",
|
|
2566
2733
|
__path,
|