plugin-elastic-report 0.0.0-stage → 0.1.1
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.
- package/ai/skills/elastic-report/SKILLS.md +32 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.js +10 -0
- package/dist/client-v2/851.488fdbf5bc5b6a36.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +20 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +99 -0
- package/dist/locale/vi-VN.json +99 -0
- package/dist/locale/zh-CN.json +99 -0
- package/dist/node_modules/@elastic/elasticsearch/.dockerignore +11 -0
- package/dist/node_modules/@elastic/elasticsearch/LICENSE +202 -0
- package/dist/node_modules/@elastic/elasticsearch/NOTICE.txt +2 -0
- package/dist/node_modules/@elastic/elasticsearch/catalog-info.yaml +50 -0
- package/dist/node_modules/@elastic/elasticsearch/codecov.yml +14 -0
- package/dist/node_modules/@elastic/elasticsearch/index.d.ts +28 -0
- package/dist/node_modules/@elastic/elasticsearch/index.js +85525 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.js +155 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.js +130 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.d.ts +193 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.js +766 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.js +395 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.d.ts +123 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.js +482 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.d.ts +245 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.js +1121 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.js +53 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.js +100 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.d.ts +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.js +169 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.js +139 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.d.ts +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.js +170 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.d.ts +25 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.d.ts +50 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.js +211 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.js +70 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.d.ts +88 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.js +329 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.js +61 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.d.ts +494 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.js +2133 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.d.ts +221 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.js +1167 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.d.ts +95 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.js +389 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.js +194 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.js +118 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.js +107 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.d.ts +522 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.js +2468 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.js +290 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.js +135 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.d.ts +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.js +260 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.js +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.d.ts +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.js +263 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.js +57 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.d.ts +81 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.js +313 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.js +63 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.js +167 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.d.ts +459 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.js +1982 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.js +125 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.js +78 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.d.ts +74 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.js +253 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.js +410 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.d.ts +53 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.js +205 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.js +96 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.js +223 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.js +109 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.js +148 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.d.ts +101 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.js +386 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.js +405 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.d.ts +25 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/index.d.ts +265 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/index.js +632 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/types.d.ts +19933 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/types.js +21 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.d.ts +20606 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.js +21 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/client.d.ts +152 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/client.js +369 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/helpers.d.ts +184 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/helpers.js +889 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.d.ts +4 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv +15 -0
- package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv.cmd +7 -0
- package/dist/node_modules/@elastic/elasticsearch/package.json +1 -0
- package/dist/node_modules/@elastic/elasticsearch/tsconfig.json +38 -0
- package/dist/server/acl-guard.js +107 -0
- package/dist/server/collections/es-report-data-views.js +79 -0
- package/dist/server/collections/es-reports.js +95 -0
- package/dist/server/index.js +58 -0
- package/dist/server/mcp/ElasticReportMcpServer.js +344 -0
- package/dist/server/mcp/ElasticReportToolCatalog.js +417 -0
- package/dist/server/plugin.js +395 -0
- package/dist/server/services/ElasticReportService.js +263 -0
- package/dist/server/services/ElasticsearchConnectionService.js +332 -0
- package/dist/server/services/ReportQueryCompiler.js +858 -0
- package/dist/shared/constants.js +81 -0
- package/dist/shared/types.js +24 -0
- package/package.json +61 -4
- package/server.d.ts +2 -0
- package/server.js +1 -0
- package/src/client/index.tsx +19 -0
- package/src/client-v2/__tests__/elastic-report.test.tsx +311 -0
- package/src/client-v2/api.ts +224 -0
- package/src/client-v2/components/ElasticBasicCharts.tsx +399 -0
- package/src/client-v2/components/ElasticReportBlock.tsx +160 -0
- package/src/client-v2/components/ElasticReportRenderer.tsx +707 -0
- package/src/client-v2/components/HighlightText.tsx +50 -0
- package/src/client-v2/components/ReportSelect.tsx +72 -0
- package/src/client-v2/index.tsx +14 -0
- package/src/client-v2/locale.ts +23 -0
- package/src/client-v2/models/ElasticReportBlockModel.tsx +85 -0
- package/src/client-v2/pages/ElasticReportManager.tsx +1047 -0
- package/src/client-v2/plugin.tsx +52 -0
- package/src/index.ts +11 -0
- package/src/locale/en-US.json +99 -0
- package/src/locale/vi-VN.json +99 -0
- package/src/locale/zh-CN.json +99 -0
- package/src/server/__tests__/query-compiler.test.ts +231 -0
- package/src/server/__tests__/report-mcp-acl.integration.test.ts +377 -0
- package/src/server/acl-guard.ts +103 -0
- package/src/server/collections/es-report-data-views.ts +58 -0
- package/src/server/collections/es-reports.ts +74 -0
- package/src/server/index.ts +15 -0
- package/src/server/mcp/ElasticReportMcpServer.ts +391 -0
- package/src/server/mcp/ElasticReportToolCatalog.ts +417 -0
- package/src/server/plugin.ts +431 -0
- package/src/server/services/ElasticReportService.ts +326 -0
- package/src/server/services/ElasticsearchConnectionService.ts +401 -0
- package/src/server/services/ReportQueryCompiler.ts +1017 -0
- package/src/shared/constants.ts +29 -0
- package/src/shared/types.ts +175 -0
- package/README.md +0 -3
|
@@ -0,0 +1,1167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
4
|
+
* license agreements. See the NOTICE file distributed with
|
|
5
|
+
* this work for additional information regarding copyright
|
|
6
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
7
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
8
|
+
* not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing,
|
|
14
|
+
* software distributed under the License is distributed on an
|
|
15
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
* KIND, either express or implied. See the License for the
|
|
17
|
+
* specific language governing permissions and limitations
|
|
18
|
+
* under the License.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
class Inference {
|
|
22
|
+
constructor(transport) {
|
|
23
|
+
Object.defineProperty(this, "transport", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: void 0
|
|
28
|
+
});
|
|
29
|
+
this.transport = transport;
|
|
30
|
+
}
|
|
31
|
+
async chatCompletionUnified(params, options) {
|
|
32
|
+
var _a;
|
|
33
|
+
const acceptedPath = ['inference_id'];
|
|
34
|
+
const acceptedBody = ['chat_completion_request'];
|
|
35
|
+
const querystring = {};
|
|
36
|
+
// @ts-expect-error
|
|
37
|
+
let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
|
|
38
|
+
for (const key in params) {
|
|
39
|
+
if (acceptedBody.includes(key)) {
|
|
40
|
+
// @ts-expect-error
|
|
41
|
+
body = params[key];
|
|
42
|
+
}
|
|
43
|
+
else if (acceptedPath.includes(key)) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
else if (key !== 'body') {
|
|
47
|
+
// @ts-expect-error
|
|
48
|
+
querystring[key] = params[key];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const method = 'POST';
|
|
52
|
+
const path = `/_inference/chat_completion/${encodeURIComponent(params.inference_id.toString())}/_stream`;
|
|
53
|
+
const meta = {
|
|
54
|
+
name: 'inference.chat_completion_unified',
|
|
55
|
+
pathParts: {
|
|
56
|
+
inference_id: params.inference_id
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
60
|
+
}
|
|
61
|
+
async completion(params, options) {
|
|
62
|
+
const acceptedPath = ['inference_id'];
|
|
63
|
+
const acceptedBody = ['input', 'task_settings'];
|
|
64
|
+
const querystring = {};
|
|
65
|
+
// @ts-expect-error
|
|
66
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
67
|
+
let body;
|
|
68
|
+
if (typeof userBody === 'string') {
|
|
69
|
+
body = userBody;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
73
|
+
}
|
|
74
|
+
for (const key in params) {
|
|
75
|
+
if (acceptedBody.includes(key)) {
|
|
76
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
77
|
+
// @ts-expect-error
|
|
78
|
+
body[key] = params[key];
|
|
79
|
+
}
|
|
80
|
+
else if (acceptedPath.includes(key)) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
else if (key !== 'body') {
|
|
84
|
+
// @ts-expect-error
|
|
85
|
+
querystring[key] = params[key];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const method = 'POST';
|
|
89
|
+
const path = `/_inference/completion/${encodeURIComponent(params.inference_id.toString())}`;
|
|
90
|
+
const meta = {
|
|
91
|
+
name: 'inference.completion',
|
|
92
|
+
pathParts: {
|
|
93
|
+
inference_id: params.inference_id
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
97
|
+
}
|
|
98
|
+
async delete(params, options) {
|
|
99
|
+
const acceptedPath = ['task_type', 'inference_id'];
|
|
100
|
+
const querystring = {};
|
|
101
|
+
const body = undefined;
|
|
102
|
+
for (const key in params) {
|
|
103
|
+
if (acceptedPath.includes(key)) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
else if (key !== 'body') {
|
|
107
|
+
// @ts-expect-error
|
|
108
|
+
querystring[key] = params[key];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let method = '';
|
|
112
|
+
let path = '';
|
|
113
|
+
if (params.task_type != null && params.inference_id != null) {
|
|
114
|
+
method = 'DELETE';
|
|
115
|
+
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
method = 'DELETE';
|
|
119
|
+
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`;
|
|
120
|
+
}
|
|
121
|
+
const meta = {
|
|
122
|
+
name: 'inference.delete',
|
|
123
|
+
pathParts: {
|
|
124
|
+
task_type: params.task_type,
|
|
125
|
+
inference_id: params.inference_id
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
129
|
+
}
|
|
130
|
+
async get(params, options) {
|
|
131
|
+
const acceptedPath = ['task_type', 'inference_id'];
|
|
132
|
+
const querystring = {};
|
|
133
|
+
const body = undefined;
|
|
134
|
+
params = params !== null && params !== void 0 ? params : {};
|
|
135
|
+
for (const key in params) {
|
|
136
|
+
if (acceptedPath.includes(key)) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
else if (key !== 'body') {
|
|
140
|
+
// @ts-expect-error
|
|
141
|
+
querystring[key] = params[key];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
let method = '';
|
|
145
|
+
let path = '';
|
|
146
|
+
if (params.task_type != null && params.inference_id != null) {
|
|
147
|
+
method = 'GET';
|
|
148
|
+
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`;
|
|
149
|
+
}
|
|
150
|
+
else if (params.inference_id != null) {
|
|
151
|
+
method = 'GET';
|
|
152
|
+
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`;
|
|
153
|
+
}
|
|
154
|
+
else if (params.task_type != null) {
|
|
155
|
+
method = 'GET';
|
|
156
|
+
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/_all`;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
method = 'GET';
|
|
160
|
+
path = '/_inference';
|
|
161
|
+
}
|
|
162
|
+
const meta = {
|
|
163
|
+
name: 'inference.get',
|
|
164
|
+
pathParts: {
|
|
165
|
+
task_type: params.task_type,
|
|
166
|
+
inference_id: params.inference_id
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
170
|
+
}
|
|
171
|
+
async inference(params, options) {
|
|
172
|
+
const acceptedPath = ['task_type', 'inference_id'];
|
|
173
|
+
const acceptedBody = ['query', 'input', 'input_type', 'task_settings'];
|
|
174
|
+
const querystring = {};
|
|
175
|
+
// @ts-expect-error
|
|
176
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
177
|
+
let body;
|
|
178
|
+
if (typeof userBody === 'string') {
|
|
179
|
+
body = userBody;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
183
|
+
}
|
|
184
|
+
for (const key in params) {
|
|
185
|
+
if (acceptedBody.includes(key)) {
|
|
186
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
187
|
+
// @ts-expect-error
|
|
188
|
+
body[key] = params[key];
|
|
189
|
+
}
|
|
190
|
+
else if (acceptedPath.includes(key)) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
else if (key !== 'body') {
|
|
194
|
+
// @ts-expect-error
|
|
195
|
+
querystring[key] = params[key];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
let method = '';
|
|
199
|
+
let path = '';
|
|
200
|
+
if (params.task_type != null && params.inference_id != null) {
|
|
201
|
+
method = 'POST';
|
|
202
|
+
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
method = 'POST';
|
|
206
|
+
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`;
|
|
207
|
+
}
|
|
208
|
+
const meta = {
|
|
209
|
+
name: 'inference.inference',
|
|
210
|
+
pathParts: {
|
|
211
|
+
task_type: params.task_type,
|
|
212
|
+
inference_id: params.inference_id
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
216
|
+
}
|
|
217
|
+
async put(params, options) {
|
|
218
|
+
var _a;
|
|
219
|
+
const acceptedPath = ['task_type', 'inference_id'];
|
|
220
|
+
const acceptedBody = ['inference_config'];
|
|
221
|
+
const querystring = {};
|
|
222
|
+
// @ts-expect-error
|
|
223
|
+
let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
|
|
224
|
+
for (const key in params) {
|
|
225
|
+
if (acceptedBody.includes(key)) {
|
|
226
|
+
// @ts-expect-error
|
|
227
|
+
body = params[key];
|
|
228
|
+
}
|
|
229
|
+
else if (acceptedPath.includes(key)) {
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
else if (key !== 'body') {
|
|
233
|
+
// @ts-expect-error
|
|
234
|
+
querystring[key] = params[key];
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
let method = '';
|
|
238
|
+
let path = '';
|
|
239
|
+
if (params.task_type != null && params.inference_id != null) {
|
|
240
|
+
method = 'PUT';
|
|
241
|
+
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
method = 'PUT';
|
|
245
|
+
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`;
|
|
246
|
+
}
|
|
247
|
+
const meta = {
|
|
248
|
+
name: 'inference.put',
|
|
249
|
+
pathParts: {
|
|
250
|
+
task_type: params.task_type,
|
|
251
|
+
inference_id: params.inference_id
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
255
|
+
}
|
|
256
|
+
async putAlibabacloud(params, options) {
|
|
257
|
+
const acceptedPath = ['task_type', 'alibabacloud_inference_id'];
|
|
258
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
259
|
+
const querystring = {};
|
|
260
|
+
// @ts-expect-error
|
|
261
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
262
|
+
let body;
|
|
263
|
+
if (typeof userBody === 'string') {
|
|
264
|
+
body = userBody;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
268
|
+
}
|
|
269
|
+
for (const key in params) {
|
|
270
|
+
if (acceptedBody.includes(key)) {
|
|
271
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
272
|
+
// @ts-expect-error
|
|
273
|
+
body[key] = params[key];
|
|
274
|
+
}
|
|
275
|
+
else if (acceptedPath.includes(key)) {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
else if (key !== 'body') {
|
|
279
|
+
// @ts-expect-error
|
|
280
|
+
querystring[key] = params[key];
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const method = 'PUT';
|
|
284
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.alibabacloud_inference_id.toString())}`;
|
|
285
|
+
const meta = {
|
|
286
|
+
name: 'inference.put_alibabacloud',
|
|
287
|
+
pathParts: {
|
|
288
|
+
task_type: params.task_type,
|
|
289
|
+
alibabacloud_inference_id: params.alibabacloud_inference_id
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
293
|
+
}
|
|
294
|
+
async putAmazonbedrock(params, options) {
|
|
295
|
+
const acceptedPath = ['task_type', 'amazonbedrock_inference_id'];
|
|
296
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
297
|
+
const querystring = {};
|
|
298
|
+
// @ts-expect-error
|
|
299
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
300
|
+
let body;
|
|
301
|
+
if (typeof userBody === 'string') {
|
|
302
|
+
body = userBody;
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
306
|
+
}
|
|
307
|
+
for (const key in params) {
|
|
308
|
+
if (acceptedBody.includes(key)) {
|
|
309
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
310
|
+
// @ts-expect-error
|
|
311
|
+
body[key] = params[key];
|
|
312
|
+
}
|
|
313
|
+
else if (acceptedPath.includes(key)) {
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
else if (key !== 'body') {
|
|
317
|
+
// @ts-expect-error
|
|
318
|
+
querystring[key] = params[key];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const method = 'PUT';
|
|
322
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.amazonbedrock_inference_id.toString())}`;
|
|
323
|
+
const meta = {
|
|
324
|
+
name: 'inference.put_amazonbedrock',
|
|
325
|
+
pathParts: {
|
|
326
|
+
task_type: params.task_type,
|
|
327
|
+
amazonbedrock_inference_id: params.amazonbedrock_inference_id
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
331
|
+
}
|
|
332
|
+
async putAmazonsagemaker(params, options) {
|
|
333
|
+
const acceptedPath = ['task_type', 'amazonsagemaker_inference_id'];
|
|
334
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
335
|
+
const querystring = {};
|
|
336
|
+
// @ts-expect-error
|
|
337
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
338
|
+
let body;
|
|
339
|
+
if (typeof userBody === 'string') {
|
|
340
|
+
body = userBody;
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
344
|
+
}
|
|
345
|
+
for (const key in params) {
|
|
346
|
+
if (acceptedBody.includes(key)) {
|
|
347
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
348
|
+
// @ts-expect-error
|
|
349
|
+
body[key] = params[key];
|
|
350
|
+
}
|
|
351
|
+
else if (acceptedPath.includes(key)) {
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
else if (key !== 'body') {
|
|
355
|
+
// @ts-expect-error
|
|
356
|
+
querystring[key] = params[key];
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const method = 'PUT';
|
|
360
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.amazonsagemaker_inference_id.toString())}`;
|
|
361
|
+
const meta = {
|
|
362
|
+
name: 'inference.put_amazonsagemaker',
|
|
363
|
+
pathParts: {
|
|
364
|
+
task_type: params.task_type,
|
|
365
|
+
amazonsagemaker_inference_id: params.amazonsagemaker_inference_id
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
369
|
+
}
|
|
370
|
+
async putAnthropic(params, options) {
|
|
371
|
+
const acceptedPath = ['task_type', 'anthropic_inference_id'];
|
|
372
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
373
|
+
const querystring = {};
|
|
374
|
+
// @ts-expect-error
|
|
375
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
376
|
+
let body;
|
|
377
|
+
if (typeof userBody === 'string') {
|
|
378
|
+
body = userBody;
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
382
|
+
}
|
|
383
|
+
for (const key in params) {
|
|
384
|
+
if (acceptedBody.includes(key)) {
|
|
385
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
386
|
+
// @ts-expect-error
|
|
387
|
+
body[key] = params[key];
|
|
388
|
+
}
|
|
389
|
+
else if (acceptedPath.includes(key)) {
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
else if (key !== 'body') {
|
|
393
|
+
// @ts-expect-error
|
|
394
|
+
querystring[key] = params[key];
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
const method = 'PUT';
|
|
398
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.anthropic_inference_id.toString())}`;
|
|
399
|
+
const meta = {
|
|
400
|
+
name: 'inference.put_anthropic',
|
|
401
|
+
pathParts: {
|
|
402
|
+
task_type: params.task_type,
|
|
403
|
+
anthropic_inference_id: params.anthropic_inference_id
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
407
|
+
}
|
|
408
|
+
async putAzureaistudio(params, options) {
|
|
409
|
+
const acceptedPath = ['task_type', 'azureaistudio_inference_id'];
|
|
410
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
411
|
+
const querystring = {};
|
|
412
|
+
// @ts-expect-error
|
|
413
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
414
|
+
let body;
|
|
415
|
+
if (typeof userBody === 'string') {
|
|
416
|
+
body = userBody;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
420
|
+
}
|
|
421
|
+
for (const key in params) {
|
|
422
|
+
if (acceptedBody.includes(key)) {
|
|
423
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
424
|
+
// @ts-expect-error
|
|
425
|
+
body[key] = params[key];
|
|
426
|
+
}
|
|
427
|
+
else if (acceptedPath.includes(key)) {
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
else if (key !== 'body') {
|
|
431
|
+
// @ts-expect-error
|
|
432
|
+
querystring[key] = params[key];
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
const method = 'PUT';
|
|
436
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.azureaistudio_inference_id.toString())}`;
|
|
437
|
+
const meta = {
|
|
438
|
+
name: 'inference.put_azureaistudio',
|
|
439
|
+
pathParts: {
|
|
440
|
+
task_type: params.task_type,
|
|
441
|
+
azureaistudio_inference_id: params.azureaistudio_inference_id
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
445
|
+
}
|
|
446
|
+
async putAzureopenai(params, options) {
|
|
447
|
+
const acceptedPath = ['task_type', 'azureopenai_inference_id'];
|
|
448
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
449
|
+
const querystring = {};
|
|
450
|
+
// @ts-expect-error
|
|
451
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
452
|
+
let body;
|
|
453
|
+
if (typeof userBody === 'string') {
|
|
454
|
+
body = userBody;
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
458
|
+
}
|
|
459
|
+
for (const key in params) {
|
|
460
|
+
if (acceptedBody.includes(key)) {
|
|
461
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
462
|
+
// @ts-expect-error
|
|
463
|
+
body[key] = params[key];
|
|
464
|
+
}
|
|
465
|
+
else if (acceptedPath.includes(key)) {
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
else if (key !== 'body') {
|
|
469
|
+
// @ts-expect-error
|
|
470
|
+
querystring[key] = params[key];
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
const method = 'PUT';
|
|
474
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.azureopenai_inference_id.toString())}`;
|
|
475
|
+
const meta = {
|
|
476
|
+
name: 'inference.put_azureopenai',
|
|
477
|
+
pathParts: {
|
|
478
|
+
task_type: params.task_type,
|
|
479
|
+
azureopenai_inference_id: params.azureopenai_inference_id
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
483
|
+
}
|
|
484
|
+
async putCohere(params, options) {
|
|
485
|
+
const acceptedPath = ['task_type', 'cohere_inference_id'];
|
|
486
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
487
|
+
const querystring = {};
|
|
488
|
+
// @ts-expect-error
|
|
489
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
490
|
+
let body;
|
|
491
|
+
if (typeof userBody === 'string') {
|
|
492
|
+
body = userBody;
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
496
|
+
}
|
|
497
|
+
for (const key in params) {
|
|
498
|
+
if (acceptedBody.includes(key)) {
|
|
499
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
500
|
+
// @ts-expect-error
|
|
501
|
+
body[key] = params[key];
|
|
502
|
+
}
|
|
503
|
+
else if (acceptedPath.includes(key)) {
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
else if (key !== 'body') {
|
|
507
|
+
// @ts-expect-error
|
|
508
|
+
querystring[key] = params[key];
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const method = 'PUT';
|
|
512
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.cohere_inference_id.toString())}`;
|
|
513
|
+
const meta = {
|
|
514
|
+
name: 'inference.put_cohere',
|
|
515
|
+
pathParts: {
|
|
516
|
+
task_type: params.task_type,
|
|
517
|
+
cohere_inference_id: params.cohere_inference_id
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
521
|
+
}
|
|
522
|
+
async putCustom(params, options) {
|
|
523
|
+
const acceptedPath = ['task_type', 'custom_inference_id'];
|
|
524
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
525
|
+
const querystring = {};
|
|
526
|
+
// @ts-expect-error
|
|
527
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
528
|
+
let body;
|
|
529
|
+
if (typeof userBody === 'string') {
|
|
530
|
+
body = userBody;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
534
|
+
}
|
|
535
|
+
for (const key in params) {
|
|
536
|
+
if (acceptedBody.includes(key)) {
|
|
537
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
538
|
+
// @ts-expect-error
|
|
539
|
+
body[key] = params[key];
|
|
540
|
+
}
|
|
541
|
+
else if (acceptedPath.includes(key)) {
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
else if (key !== 'body') {
|
|
545
|
+
// @ts-expect-error
|
|
546
|
+
querystring[key] = params[key];
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const method = 'PUT';
|
|
550
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.custom_inference_id.toString())}`;
|
|
551
|
+
const meta = {
|
|
552
|
+
name: 'inference.put_custom',
|
|
553
|
+
pathParts: {
|
|
554
|
+
task_type: params.task_type,
|
|
555
|
+
custom_inference_id: params.custom_inference_id
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
559
|
+
}
|
|
560
|
+
async putDeepseek(params, options) {
|
|
561
|
+
const acceptedPath = ['task_type', 'deepseek_inference_id'];
|
|
562
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings'];
|
|
563
|
+
const querystring = {};
|
|
564
|
+
// @ts-expect-error
|
|
565
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
566
|
+
let body;
|
|
567
|
+
if (typeof userBody === 'string') {
|
|
568
|
+
body = userBody;
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
572
|
+
}
|
|
573
|
+
for (const key in params) {
|
|
574
|
+
if (acceptedBody.includes(key)) {
|
|
575
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
576
|
+
// @ts-expect-error
|
|
577
|
+
body[key] = params[key];
|
|
578
|
+
}
|
|
579
|
+
else if (acceptedPath.includes(key)) {
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
else if (key !== 'body') {
|
|
583
|
+
// @ts-expect-error
|
|
584
|
+
querystring[key] = params[key];
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const method = 'PUT';
|
|
588
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.deepseek_inference_id.toString())}`;
|
|
589
|
+
const meta = {
|
|
590
|
+
name: 'inference.put_deepseek',
|
|
591
|
+
pathParts: {
|
|
592
|
+
task_type: params.task_type,
|
|
593
|
+
deepseek_inference_id: params.deepseek_inference_id
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
597
|
+
}
|
|
598
|
+
async putElasticsearch(params, options) {
|
|
599
|
+
const acceptedPath = ['task_type', 'elasticsearch_inference_id'];
|
|
600
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
601
|
+
const querystring = {};
|
|
602
|
+
// @ts-expect-error
|
|
603
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
604
|
+
let body;
|
|
605
|
+
if (typeof userBody === 'string') {
|
|
606
|
+
body = userBody;
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
610
|
+
}
|
|
611
|
+
for (const key in params) {
|
|
612
|
+
if (acceptedBody.includes(key)) {
|
|
613
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
614
|
+
// @ts-expect-error
|
|
615
|
+
body[key] = params[key];
|
|
616
|
+
}
|
|
617
|
+
else if (acceptedPath.includes(key)) {
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
else if (key !== 'body') {
|
|
621
|
+
// @ts-expect-error
|
|
622
|
+
querystring[key] = params[key];
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
const method = 'PUT';
|
|
626
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.elasticsearch_inference_id.toString())}`;
|
|
627
|
+
const meta = {
|
|
628
|
+
name: 'inference.put_elasticsearch',
|
|
629
|
+
pathParts: {
|
|
630
|
+
task_type: params.task_type,
|
|
631
|
+
elasticsearch_inference_id: params.elasticsearch_inference_id
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
635
|
+
}
|
|
636
|
+
async putElser(params, options) {
|
|
637
|
+
const acceptedPath = ['task_type', 'elser_inference_id'];
|
|
638
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings'];
|
|
639
|
+
const querystring = {};
|
|
640
|
+
// @ts-expect-error
|
|
641
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
642
|
+
let body;
|
|
643
|
+
if (typeof userBody === 'string') {
|
|
644
|
+
body = userBody;
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
648
|
+
}
|
|
649
|
+
for (const key in params) {
|
|
650
|
+
if (acceptedBody.includes(key)) {
|
|
651
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
652
|
+
// @ts-expect-error
|
|
653
|
+
body[key] = params[key];
|
|
654
|
+
}
|
|
655
|
+
else if (acceptedPath.includes(key)) {
|
|
656
|
+
continue;
|
|
657
|
+
}
|
|
658
|
+
else if (key !== 'body') {
|
|
659
|
+
// @ts-expect-error
|
|
660
|
+
querystring[key] = params[key];
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
const method = 'PUT';
|
|
664
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.elser_inference_id.toString())}`;
|
|
665
|
+
const meta = {
|
|
666
|
+
name: 'inference.put_elser',
|
|
667
|
+
pathParts: {
|
|
668
|
+
task_type: params.task_type,
|
|
669
|
+
elser_inference_id: params.elser_inference_id
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
673
|
+
}
|
|
674
|
+
async putGoogleaistudio(params, options) {
|
|
675
|
+
const acceptedPath = ['task_type', 'googleaistudio_inference_id'];
|
|
676
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings'];
|
|
677
|
+
const querystring = {};
|
|
678
|
+
// @ts-expect-error
|
|
679
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
680
|
+
let body;
|
|
681
|
+
if (typeof userBody === 'string') {
|
|
682
|
+
body = userBody;
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
686
|
+
}
|
|
687
|
+
for (const key in params) {
|
|
688
|
+
if (acceptedBody.includes(key)) {
|
|
689
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
690
|
+
// @ts-expect-error
|
|
691
|
+
body[key] = params[key];
|
|
692
|
+
}
|
|
693
|
+
else if (acceptedPath.includes(key)) {
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
696
|
+
else if (key !== 'body') {
|
|
697
|
+
// @ts-expect-error
|
|
698
|
+
querystring[key] = params[key];
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
const method = 'PUT';
|
|
702
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.googleaistudio_inference_id.toString())}`;
|
|
703
|
+
const meta = {
|
|
704
|
+
name: 'inference.put_googleaistudio',
|
|
705
|
+
pathParts: {
|
|
706
|
+
task_type: params.task_type,
|
|
707
|
+
googleaistudio_inference_id: params.googleaistudio_inference_id
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
711
|
+
}
|
|
712
|
+
async putGooglevertexai(params, options) {
|
|
713
|
+
const acceptedPath = ['task_type', 'googlevertexai_inference_id'];
|
|
714
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
715
|
+
const querystring = {};
|
|
716
|
+
// @ts-expect-error
|
|
717
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
718
|
+
let body;
|
|
719
|
+
if (typeof userBody === 'string') {
|
|
720
|
+
body = userBody;
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
724
|
+
}
|
|
725
|
+
for (const key in params) {
|
|
726
|
+
if (acceptedBody.includes(key)) {
|
|
727
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
728
|
+
// @ts-expect-error
|
|
729
|
+
body[key] = params[key];
|
|
730
|
+
}
|
|
731
|
+
else if (acceptedPath.includes(key)) {
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
else if (key !== 'body') {
|
|
735
|
+
// @ts-expect-error
|
|
736
|
+
querystring[key] = params[key];
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
const method = 'PUT';
|
|
740
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.googlevertexai_inference_id.toString())}`;
|
|
741
|
+
const meta = {
|
|
742
|
+
name: 'inference.put_googlevertexai',
|
|
743
|
+
pathParts: {
|
|
744
|
+
task_type: params.task_type,
|
|
745
|
+
googlevertexai_inference_id: params.googlevertexai_inference_id
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
749
|
+
}
|
|
750
|
+
async putHuggingFace(params, options) {
|
|
751
|
+
const acceptedPath = ['task_type', 'huggingface_inference_id'];
|
|
752
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
753
|
+
const querystring = {};
|
|
754
|
+
// @ts-expect-error
|
|
755
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
756
|
+
let body;
|
|
757
|
+
if (typeof userBody === 'string') {
|
|
758
|
+
body = userBody;
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
762
|
+
}
|
|
763
|
+
for (const key in params) {
|
|
764
|
+
if (acceptedBody.includes(key)) {
|
|
765
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
766
|
+
// @ts-expect-error
|
|
767
|
+
body[key] = params[key];
|
|
768
|
+
}
|
|
769
|
+
else if (acceptedPath.includes(key)) {
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
else if (key !== 'body') {
|
|
773
|
+
// @ts-expect-error
|
|
774
|
+
querystring[key] = params[key];
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
const method = 'PUT';
|
|
778
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.huggingface_inference_id.toString())}`;
|
|
779
|
+
const meta = {
|
|
780
|
+
name: 'inference.put_hugging_face',
|
|
781
|
+
pathParts: {
|
|
782
|
+
task_type: params.task_type,
|
|
783
|
+
huggingface_inference_id: params.huggingface_inference_id
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
787
|
+
}
|
|
788
|
+
async putJinaai(params, options) {
|
|
789
|
+
const acceptedPath = ['task_type', 'jinaai_inference_id'];
|
|
790
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
791
|
+
const querystring = {};
|
|
792
|
+
// @ts-expect-error
|
|
793
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
794
|
+
let body;
|
|
795
|
+
if (typeof userBody === 'string') {
|
|
796
|
+
body = userBody;
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
800
|
+
}
|
|
801
|
+
for (const key in params) {
|
|
802
|
+
if (acceptedBody.includes(key)) {
|
|
803
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
804
|
+
// @ts-expect-error
|
|
805
|
+
body[key] = params[key];
|
|
806
|
+
}
|
|
807
|
+
else if (acceptedPath.includes(key)) {
|
|
808
|
+
continue;
|
|
809
|
+
}
|
|
810
|
+
else if (key !== 'body') {
|
|
811
|
+
// @ts-expect-error
|
|
812
|
+
querystring[key] = params[key];
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
const method = 'PUT';
|
|
816
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.jinaai_inference_id.toString())}`;
|
|
817
|
+
const meta = {
|
|
818
|
+
name: 'inference.put_jinaai',
|
|
819
|
+
pathParts: {
|
|
820
|
+
task_type: params.task_type,
|
|
821
|
+
jinaai_inference_id: params.jinaai_inference_id
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
825
|
+
}
|
|
826
|
+
async putMistral(params, options) {
|
|
827
|
+
const acceptedPath = ['task_type', 'mistral_inference_id'];
|
|
828
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings'];
|
|
829
|
+
const querystring = {};
|
|
830
|
+
// @ts-expect-error
|
|
831
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
832
|
+
let body;
|
|
833
|
+
if (typeof userBody === 'string') {
|
|
834
|
+
body = userBody;
|
|
835
|
+
}
|
|
836
|
+
else {
|
|
837
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
838
|
+
}
|
|
839
|
+
for (const key in params) {
|
|
840
|
+
if (acceptedBody.includes(key)) {
|
|
841
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
842
|
+
// @ts-expect-error
|
|
843
|
+
body[key] = params[key];
|
|
844
|
+
}
|
|
845
|
+
else if (acceptedPath.includes(key)) {
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
else if (key !== 'body') {
|
|
849
|
+
// @ts-expect-error
|
|
850
|
+
querystring[key] = params[key];
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
const method = 'PUT';
|
|
854
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.mistral_inference_id.toString())}`;
|
|
855
|
+
const meta = {
|
|
856
|
+
name: 'inference.put_mistral',
|
|
857
|
+
pathParts: {
|
|
858
|
+
task_type: params.task_type,
|
|
859
|
+
mistral_inference_id: params.mistral_inference_id
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
863
|
+
}
|
|
864
|
+
async putOpenai(params, options) {
|
|
865
|
+
const acceptedPath = ['task_type', 'openai_inference_id'];
|
|
866
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
867
|
+
const querystring = {};
|
|
868
|
+
// @ts-expect-error
|
|
869
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
870
|
+
let body;
|
|
871
|
+
if (typeof userBody === 'string') {
|
|
872
|
+
body = userBody;
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
876
|
+
}
|
|
877
|
+
for (const key in params) {
|
|
878
|
+
if (acceptedBody.includes(key)) {
|
|
879
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
880
|
+
// @ts-expect-error
|
|
881
|
+
body[key] = params[key];
|
|
882
|
+
}
|
|
883
|
+
else if (acceptedPath.includes(key)) {
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
else if (key !== 'body') {
|
|
887
|
+
// @ts-expect-error
|
|
888
|
+
querystring[key] = params[key];
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
const method = 'PUT';
|
|
892
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.openai_inference_id.toString())}`;
|
|
893
|
+
const meta = {
|
|
894
|
+
name: 'inference.put_openai',
|
|
895
|
+
pathParts: {
|
|
896
|
+
task_type: params.task_type,
|
|
897
|
+
openai_inference_id: params.openai_inference_id
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
901
|
+
}
|
|
902
|
+
async putVoyageai(params, options) {
|
|
903
|
+
const acceptedPath = ['task_type', 'voyageai_inference_id'];
|
|
904
|
+
const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
|
|
905
|
+
const querystring = {};
|
|
906
|
+
// @ts-expect-error
|
|
907
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
908
|
+
let body;
|
|
909
|
+
if (typeof userBody === 'string') {
|
|
910
|
+
body = userBody;
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
914
|
+
}
|
|
915
|
+
for (const key in params) {
|
|
916
|
+
if (acceptedBody.includes(key)) {
|
|
917
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
918
|
+
// @ts-expect-error
|
|
919
|
+
body[key] = params[key];
|
|
920
|
+
}
|
|
921
|
+
else if (acceptedPath.includes(key)) {
|
|
922
|
+
continue;
|
|
923
|
+
}
|
|
924
|
+
else if (key !== 'body') {
|
|
925
|
+
// @ts-expect-error
|
|
926
|
+
querystring[key] = params[key];
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
const method = 'PUT';
|
|
930
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.voyageai_inference_id.toString())}`;
|
|
931
|
+
const meta = {
|
|
932
|
+
name: 'inference.put_voyageai',
|
|
933
|
+
pathParts: {
|
|
934
|
+
task_type: params.task_type,
|
|
935
|
+
voyageai_inference_id: params.voyageai_inference_id
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
939
|
+
}
|
|
940
|
+
async putWatsonx(params, options) {
|
|
941
|
+
const acceptedPath = ['task_type', 'watsonx_inference_id'];
|
|
942
|
+
const acceptedBody = ['service', 'service_settings'];
|
|
943
|
+
const querystring = {};
|
|
944
|
+
// @ts-expect-error
|
|
945
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
946
|
+
let body;
|
|
947
|
+
if (typeof userBody === 'string') {
|
|
948
|
+
body = userBody;
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
952
|
+
}
|
|
953
|
+
for (const key in params) {
|
|
954
|
+
if (acceptedBody.includes(key)) {
|
|
955
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
956
|
+
// @ts-expect-error
|
|
957
|
+
body[key] = params[key];
|
|
958
|
+
}
|
|
959
|
+
else if (acceptedPath.includes(key)) {
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
else if (key !== 'body') {
|
|
963
|
+
// @ts-expect-error
|
|
964
|
+
querystring[key] = params[key];
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
const method = 'PUT';
|
|
968
|
+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.watsonx_inference_id.toString())}`;
|
|
969
|
+
const meta = {
|
|
970
|
+
name: 'inference.put_watsonx',
|
|
971
|
+
pathParts: {
|
|
972
|
+
task_type: params.task_type,
|
|
973
|
+
watsonx_inference_id: params.watsonx_inference_id
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
977
|
+
}
|
|
978
|
+
async rerank(params, options) {
|
|
979
|
+
const acceptedPath = ['inference_id'];
|
|
980
|
+
const acceptedBody = ['query', 'input', 'task_settings'];
|
|
981
|
+
const querystring = {};
|
|
982
|
+
// @ts-expect-error
|
|
983
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
984
|
+
let body;
|
|
985
|
+
if (typeof userBody === 'string') {
|
|
986
|
+
body = userBody;
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
990
|
+
}
|
|
991
|
+
for (const key in params) {
|
|
992
|
+
if (acceptedBody.includes(key)) {
|
|
993
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
994
|
+
// @ts-expect-error
|
|
995
|
+
body[key] = params[key];
|
|
996
|
+
}
|
|
997
|
+
else if (acceptedPath.includes(key)) {
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
else if (key !== 'body') {
|
|
1001
|
+
// @ts-expect-error
|
|
1002
|
+
querystring[key] = params[key];
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
const method = 'POST';
|
|
1006
|
+
const path = `/_inference/rerank/${encodeURIComponent(params.inference_id.toString())}`;
|
|
1007
|
+
const meta = {
|
|
1008
|
+
name: 'inference.rerank',
|
|
1009
|
+
pathParts: {
|
|
1010
|
+
inference_id: params.inference_id
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
1014
|
+
}
|
|
1015
|
+
async sparseEmbedding(params, options) {
|
|
1016
|
+
const acceptedPath = ['inference_id'];
|
|
1017
|
+
const acceptedBody = ['input', 'task_settings'];
|
|
1018
|
+
const querystring = {};
|
|
1019
|
+
// @ts-expect-error
|
|
1020
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
1021
|
+
let body;
|
|
1022
|
+
if (typeof userBody === 'string') {
|
|
1023
|
+
body = userBody;
|
|
1024
|
+
}
|
|
1025
|
+
else {
|
|
1026
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
1027
|
+
}
|
|
1028
|
+
for (const key in params) {
|
|
1029
|
+
if (acceptedBody.includes(key)) {
|
|
1030
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
1031
|
+
// @ts-expect-error
|
|
1032
|
+
body[key] = params[key];
|
|
1033
|
+
}
|
|
1034
|
+
else if (acceptedPath.includes(key)) {
|
|
1035
|
+
continue;
|
|
1036
|
+
}
|
|
1037
|
+
else if (key !== 'body') {
|
|
1038
|
+
// @ts-expect-error
|
|
1039
|
+
querystring[key] = params[key];
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
const method = 'POST';
|
|
1043
|
+
const path = `/_inference/sparse_embedding/${encodeURIComponent(params.inference_id.toString())}`;
|
|
1044
|
+
const meta = {
|
|
1045
|
+
name: 'inference.sparse_embedding',
|
|
1046
|
+
pathParts: {
|
|
1047
|
+
inference_id: params.inference_id
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
1051
|
+
}
|
|
1052
|
+
async streamCompletion(params, options) {
|
|
1053
|
+
const acceptedPath = ['inference_id'];
|
|
1054
|
+
const acceptedBody = ['input', 'task_settings'];
|
|
1055
|
+
const querystring = {};
|
|
1056
|
+
// @ts-expect-error
|
|
1057
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
1058
|
+
let body;
|
|
1059
|
+
if (typeof userBody === 'string') {
|
|
1060
|
+
body = userBody;
|
|
1061
|
+
}
|
|
1062
|
+
else {
|
|
1063
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
1064
|
+
}
|
|
1065
|
+
for (const key in params) {
|
|
1066
|
+
if (acceptedBody.includes(key)) {
|
|
1067
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
1068
|
+
// @ts-expect-error
|
|
1069
|
+
body[key] = params[key];
|
|
1070
|
+
}
|
|
1071
|
+
else if (acceptedPath.includes(key)) {
|
|
1072
|
+
continue;
|
|
1073
|
+
}
|
|
1074
|
+
else if (key !== 'body') {
|
|
1075
|
+
// @ts-expect-error
|
|
1076
|
+
querystring[key] = params[key];
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
const method = 'POST';
|
|
1080
|
+
const path = `/_inference/completion/${encodeURIComponent(params.inference_id.toString())}/_stream`;
|
|
1081
|
+
const meta = {
|
|
1082
|
+
name: 'inference.stream_completion',
|
|
1083
|
+
pathParts: {
|
|
1084
|
+
inference_id: params.inference_id
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
1088
|
+
}
|
|
1089
|
+
async textEmbedding(params, options) {
|
|
1090
|
+
const acceptedPath = ['inference_id'];
|
|
1091
|
+
const acceptedBody = ['input', 'input_type', 'task_settings'];
|
|
1092
|
+
const querystring = {};
|
|
1093
|
+
// @ts-expect-error
|
|
1094
|
+
const userBody = params === null || params === void 0 ? void 0 : params.body;
|
|
1095
|
+
let body;
|
|
1096
|
+
if (typeof userBody === 'string') {
|
|
1097
|
+
body = userBody;
|
|
1098
|
+
}
|
|
1099
|
+
else {
|
|
1100
|
+
body = userBody != null ? { ...userBody } : undefined;
|
|
1101
|
+
}
|
|
1102
|
+
for (const key in params) {
|
|
1103
|
+
if (acceptedBody.includes(key)) {
|
|
1104
|
+
body = body !== null && body !== void 0 ? body : {};
|
|
1105
|
+
// @ts-expect-error
|
|
1106
|
+
body[key] = params[key];
|
|
1107
|
+
}
|
|
1108
|
+
else if (acceptedPath.includes(key)) {
|
|
1109
|
+
continue;
|
|
1110
|
+
}
|
|
1111
|
+
else if (key !== 'body') {
|
|
1112
|
+
// @ts-expect-error
|
|
1113
|
+
querystring[key] = params[key];
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
const method = 'POST';
|
|
1117
|
+
const path = `/_inference/text_embedding/${encodeURIComponent(params.inference_id.toString())}`;
|
|
1118
|
+
const meta = {
|
|
1119
|
+
name: 'inference.text_embedding',
|
|
1120
|
+
pathParts: {
|
|
1121
|
+
inference_id: params.inference_id
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
1125
|
+
}
|
|
1126
|
+
async update(params, options) {
|
|
1127
|
+
var _a;
|
|
1128
|
+
const acceptedPath = ['inference_id', 'task_type'];
|
|
1129
|
+
const acceptedBody = ['inference_config'];
|
|
1130
|
+
const querystring = {};
|
|
1131
|
+
// @ts-expect-error
|
|
1132
|
+
let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
|
|
1133
|
+
for (const key in params) {
|
|
1134
|
+
if (acceptedBody.includes(key)) {
|
|
1135
|
+
// @ts-expect-error
|
|
1136
|
+
body = params[key];
|
|
1137
|
+
}
|
|
1138
|
+
else if (acceptedPath.includes(key)) {
|
|
1139
|
+
continue;
|
|
1140
|
+
}
|
|
1141
|
+
else if (key !== 'body') {
|
|
1142
|
+
// @ts-expect-error
|
|
1143
|
+
querystring[key] = params[key];
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
let method = '';
|
|
1147
|
+
let path = '';
|
|
1148
|
+
if (params.task_type != null && params.inference_id != null) {
|
|
1149
|
+
method = 'PUT';
|
|
1150
|
+
path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}/_update`;
|
|
1151
|
+
}
|
|
1152
|
+
else {
|
|
1153
|
+
method = 'PUT';
|
|
1154
|
+
path = `/_inference/${encodeURIComponent(params.inference_id.toString())}/_update`;
|
|
1155
|
+
}
|
|
1156
|
+
const meta = {
|
|
1157
|
+
name: 'inference.update',
|
|
1158
|
+
pathParts: {
|
|
1159
|
+
inference_id: params.inference_id,
|
|
1160
|
+
task_type: params.task_type
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
return await this.transport.request({ path, method, querystring, body, meta }, options);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
exports.default = Inference;
|
|
1167
|
+
//# sourceMappingURL=inference.js.map
|