Skip to content

Commit fdd4227

Browse files
Auto-generated API code (#2900)
1 parent 32ec889 commit fdd4227

File tree

6 files changed

+936
-155
lines changed

6 files changed

+936
-155
lines changed

docs/reference.asciidoc

Lines changed: 53 additions & 20 deletions
Large diffs are not rendered by default.

src/api/api/inference.ts

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export default class Inference {
262262
}
263263

264264
/**
265-
* Create an inference endpoint. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. 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. The following integrations are available through the inference API. You can find the available task types next to the integration name: * AlibabaCloud AI Search (`completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Amazon Bedrock (`completion`, `text_embedding`) * Anthropic (`completion`) * Azure AI Studio (`completion`, `text_embedding`) * Azure OpenAI (`completion`, `text_embedding`) * Cohere (`completion`, `rerank`, `text_embedding`) * Elasticsearch (`rerank`, `sparse_embedding`, `text_embedding` - this service is for built-in models and models uploaded through Eland) * ELSER (`sparse_embedding`) * Google AI Studio (`completion`, `text_embedding`) * Google Vertex AI (`rerank`, `text_embedding`) * Hugging Face (`chat_completion`, `completion`, `rerank`, `text_embedding`) * Mistral (`chat_completion`, `completion`, `text_embedding`) * OpenAI (`chat_completion`, `completion`, `text_embedding`) * VoyageAI (`text_embedding`, `rerank`) * Watsonx inference integration (`text_embedding`) * JinaAI (`text_embedding`, `rerank`)
265+
* Create an inference endpoint. IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. 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. The following integrations are available through the inference API. You can find the available task types next to the integration name: * AlibabaCloud AI Search (`completion`, `rerank`, `sparse_embedding`, `text_embedding`) * Amazon Bedrock (`completion`, `text_embedding`) * Anthropic (`completion`) * Azure AI Studio (`completion`, `text_embedding`) * Azure OpenAI (`completion`, `text_embedding`) * Cohere (`completion`, `rerank`, `text_embedding`) * DeepSeek (`completion`, `chat_completion`) * Elasticsearch (`rerank`, `sparse_embedding`, `text_embedding` - this service is for built-in models and models uploaded through Eland) * ELSER (`sparse_embedding`) * Google AI Studio (`completion`, `text_embedding`) * Google Vertex AI (`rerank`, `text_embedding`) * Hugging Face (`chat_completion`, `completion`, `rerank`, `text_embedding`) * Mistral (`chat_completion`, `completion`, `text_embedding`) * OpenAI (`chat_completion`, `completion`, `text_embedding`) * VoyageAI (`text_embedding`, `rerank`) * Watsonx inference integration (`text_embedding`) * JinaAI (`text_embedding`, `rerank`)
266266
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/put-inference-api.html | Elasticsearch API documentation}
267267
*/
268268
async put (this: That, params: T.InferencePutRequest | TB.InferencePutRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferencePutResponse>
@@ -396,6 +396,39 @@ export default class Inference {
396396
return await this.transport.request({ path, method, querystring, body, meta }, options)
397397
}
398398

399+
/**
400+
* Configure a Amazon SageMaker inference endpoint
401+
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/infer-service-amazon-sagemaker.html | Elasticsearch API documentation}
402+
*/
403+
async putAmazonsagemaker (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
404+
async putAmazonsagemaker (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
405+
async putAmazonsagemaker (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
406+
async putAmazonsagemaker (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
407+
const acceptedPath: string[] = ['task_type', 'amazonsagemaker_inference_id']
408+
const querystring: Record<string, any> = {}
409+
const body = undefined
410+
411+
params = params ?? {}
412+
for (const key in params) {
413+
if (acceptedPath.includes(key)) {
414+
continue
415+
} else if (key !== 'body') {
416+
querystring[key] = params[key]
417+
}
418+
}
419+
420+
const method = 'PUT'
421+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.amazonsagemaker_inference_id.toString())}`
422+
const meta: TransportRequestMetadata = {
423+
name: 'inference.put_amazonsagemaker',
424+
pathParts: {
425+
task_type: params.task_type,
426+
amazonsagemaker_inference_id: params.amazonsagemaker_inference_id
427+
}
428+
}
429+
return await this.transport.request({ path, method, querystring, body, meta }, options)
430+
}
431+
399432
/**
400433
* Create an Anthropic inference endpoint. Create an inference endpoint to perform an inference task with the `anthropic` service.
401434
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/infer-service-anthropic.html | Elasticsearch API documentation}
@@ -576,6 +609,51 @@ export default class Inference {
576609
return await this.transport.request({ path, method, querystring, body, meta }, options)
577610
}
578611

612+
/**
613+
* Create a DeepSeek inference endpoint. Create an inference endpoint to perform an inference task with the `deepseek` service.
614+
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/infer-service-deepseek.html | Elasticsearch API documentation}
615+
*/
616+
async putDeepseek (this: That, params: T.InferencePutDeepseekRequest | TB.InferencePutDeepseekRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.InferencePutDeepseekResponse>
617+
async putDeepseek (this: That, params: T.InferencePutDeepseekRequest | TB.InferencePutDeepseekRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.InferencePutDeepseekResponse, unknown>>
618+
async putDeepseek (this: That, params: T.InferencePutDeepseekRequest | TB.InferencePutDeepseekRequest, options?: TransportRequestOptions): Promise<T.InferencePutDeepseekResponse>
619+
async putDeepseek (this: That, params: T.InferencePutDeepseekRequest | TB.InferencePutDeepseekRequest, options?: TransportRequestOptions): Promise<any> {
620+
const acceptedPath: string[] = ['task_type', 'deepseek_inference_id']
621+
const acceptedBody: string[] = ['chunking_settings', 'service', 'service_settings']
622+
const querystring: Record<string, any> = {}
623+
// @ts-expect-error
624+
const userBody: any = params?.body
625+
let body: Record<string, any> | string
626+
if (typeof userBody === 'string') {
627+
body = userBody
628+
} else {
629+
body = userBody != null ? { ...userBody } : undefined
630+
}
631+
632+
for (const key in params) {
633+
if (acceptedBody.includes(key)) {
634+
body = body ?? {}
635+
// @ts-expect-error
636+
body[key] = params[key]
637+
} else if (acceptedPath.includes(key)) {
638+
continue
639+
} else if (key !== 'body') {
640+
// @ts-expect-error
641+
querystring[key] = params[key]
642+
}
643+
}
644+
645+
const method = 'PUT'
646+
const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.deepseek_inference_id.toString())}`
647+
const meta: TransportRequestMetadata = {
648+
name: 'inference.put_deepseek',
649+
pathParts: {
650+
task_type: params.task_type,
651+
deepseek_inference_id: params.deepseek_inference_id
652+
}
653+
}
654+
return await this.transport.request({ path, method, querystring, body, meta }, options)
655+
}
656+
579657
/**
580658
* Create an Elasticsearch inference endpoint. Create an inference endpoint to perform an inference task with the `elasticsearch` service. > info > Your Elasticsearch deployment contains preconfigured ELSER and E5 inference endpoints, you only need to create the enpoints using the API if you want to customize the settings. If you use the ELSER or the E5 model through the `elasticsearch` service, the API request will automatically download and deploy the model if it isn't downloaded yet. > info > You might see a 502 bad gateway error in the response when using the Kibana Console. This error usually just reflects a timeout, while the model downloads in the background. You can check the download progress in the Machine Learning UI. If using the Python client, you can set the timeout parameter to a higher value. After creating the endpoint, wait for the model deployment to complete before using it. To verify the deployment status, use the get trained model statistics API. Look for `"state": "fully_allocated"` in the response and ensure that the `"allocation_count"` matches the `"target_allocation_count"`. Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.
581659
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/infer-service-elasticsearch.html | Elasticsearch API documentation}

src/api/api/streams.ts

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
/* eslint-disable import/export */
21+
/* eslint-disable @typescript-eslint/no-misused-new */
22+
/* eslint-disable @typescript-eslint/no-extraneous-class */
23+
/* eslint-disable @typescript-eslint/no-unused-vars */
24+
25+
// This file was automatically generated by elastic/elastic-client-generator-js
26+
// DO NOT MODIFY IT BY HAND. Instead, modify the source open api file,
27+
// and elastic/elastic-client-generator-js to regenerate this file again.
28+
29+
import {
30+
Transport,
31+
TransportRequestMetadata,
32+
TransportRequestOptions,
33+
TransportRequestOptionsWithMeta,
34+
TransportRequestOptionsWithOutMeta,
35+
TransportResult
36+
} from '@elastic/transport'
37+
import * as T from '../types'
38+
import * as TB from '../typesWithBodyKey'
39+
interface That { transport: Transport }
40+
41+
export default class Streams {
42+
transport: Transport
43+
constructor (transport: Transport) {
44+
this.transport = transport
45+
}
46+
47+
/**
48+
* Disable the Logs Streams feature for this cluster
49+
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/streams-logs-disable.html | Elasticsearch API documentation}
50+
*/
51+
async logsDisable (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
52+
async logsDisable (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
53+
async logsDisable (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
54+
async logsDisable (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
55+
const acceptedPath: string[] = []
56+
const querystring: Record<string, any> = {}
57+
const body = undefined
58+
59+
params = params ?? {}
60+
for (const key in params) {
61+
if (acceptedPath.includes(key)) {
62+
continue
63+
} else if (key !== 'body') {
64+
querystring[key] = params[key]
65+
}
66+
}
67+
68+
const method = 'POST'
69+
const path = '/_streams/logs/_disable'
70+
const meta: TransportRequestMetadata = {
71+
name: 'streams.logs_disable'
72+
}
73+
return await this.transport.request({ path, method, querystring, body, meta }, options)
74+
}
75+
76+
/**
77+
* Enable the Logs Streams feature for this cluster
78+
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/streams-logs-enable.html | Elasticsearch API documentation}
79+
*/
80+
async logsEnable (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
81+
async logsEnable (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
82+
async logsEnable (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
83+
async logsEnable (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
84+
const acceptedPath: string[] = []
85+
const querystring: Record<string, any> = {}
86+
const body = undefined
87+
88+
params = params ?? {}
89+
for (const key in params) {
90+
if (acceptedPath.includes(key)) {
91+
continue
92+
} else if (key !== 'body') {
93+
querystring[key] = params[key]
94+
}
95+
}
96+
97+
const method = 'POST'
98+
const path = '/_streams/logs/_enable'
99+
const meta: TransportRequestMetadata = {
100+
name: 'streams.logs_enable'
101+
}
102+
return await this.transport.request({ path, method, querystring, body, meta }, options)
103+
}
104+
105+
/**
106+
* Return the current status of the streams feature for each streams type
107+
* @see {@link https://www.elastic.co/guide/en/elasticsearch/reference/8.19/streams-status.html | Elasticsearch API documentation}
108+
*/
109+
async status (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
110+
async status (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
111+
async status (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
112+
async status (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
113+
const acceptedPath: string[] = []
114+
const querystring: Record<string, any> = {}
115+
const body = undefined
116+
117+
params = params ?? {}
118+
for (const key in params) {
119+
if (acceptedPath.includes(key)) {
120+
continue
121+
} else if (key !== 'body') {
122+
querystring[key] = params[key]
123+
}
124+
}
125+
126+
const method = 'GET'
127+
const path = '/_streams/status'
128+
const meta: TransportRequestMetadata = {
129+
name: 'streams.status'
130+
}
131+
return await this.transport.request({ path, method, querystring, body, meta }, options)
132+
}
133+
}

src/api/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ import SlmApi from './api/slm'
101101
import SnapshotApi from './api/snapshot'
102102
import SqlApi from './api/sql'
103103
import SslApi from './api/ssl'
104+
import StreamsApi from './api/streams'
104105
import SynonymsApi from './api/synonyms'
105106
import TasksApi from './api/tasks'
106107
import termsEnumApi from './api/terms_enum'
@@ -190,6 +191,7 @@ export default interface API {
190191
snapshot: SnapshotApi
191192
sql: SqlApi
192193
ssl: SslApi
194+
streams: StreamsApi
193195
synonyms: SynonymsApi
194196
tasks: TasksApi
195197
termsEnum: typeof termsEnumApi
@@ -238,6 +240,7 @@ const kSlm = Symbol('Slm')
238240
const kSnapshot = Symbol('Snapshot')
239241
const kSql = Symbol('Sql')
240242
const kSsl = Symbol('Ssl')
243+
const kStreams = Symbol('Streams')
241244
const kSynonyms = Symbol('Synonyms')
242245
const kTasks = Symbol('Tasks')
243246
const kTextStructure = Symbol('TextStructure')
@@ -281,6 +284,7 @@ export default class API {
281284
[kSnapshot]: symbol | null
282285
[kSql]: symbol | null
283286
[kSsl]: symbol | null
287+
[kStreams]: symbol | null
284288
[kSynonyms]: symbol | null
285289
[kTasks]: symbol | null
286290
[kTextStructure]: symbol | null
@@ -323,6 +327,7 @@ export default class API {
323327
this[kSnapshot] = null
324328
this[kSql] = null
325329
this[kSsl] = null
330+
this[kStreams] = null
326331
this[kSynonyms] = null
327332
this[kTasks] = null
328333
this[kTextStructure] = null
@@ -484,6 +489,9 @@ Object.defineProperties(API.prototype, {
484489
ssl: {
485490
get () { return this[kSsl] === null ? (this[kSsl] = new SslApi(this.transport)) : this[kSsl] }
486491
},
492+
streams: {
493+
get () { return this[kStreams] === null ? (this[kStreams] = new StreamsApi(this.transport)) : this[kStreams] }
494+
},
487495
synonyms: {
488496
get () { return this[kSynonyms] === null ? (this[kSynonyms] = new SynonymsApi(this.transport)) : this[kSynonyms] }
489497
},

0 commit comments

Comments
 (0)