You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- **`task_type` (Enum("rerank"))**: The type of the inference task that the model will perform.
7869
+
- **`contextualai_inference_id` (string)**: The unique identifier of the inference endpoint.
7870
+
- **`service` (Enum("contextualai"))**: The type of service supported for the specified task type. In this case, `contextualai`.
7871
+
- **`service_settings` ({ api_key, model_id, rate_limit })**: Settings used to install the inference model. These settings are specific to the `contextualai` service.
Copy file name to clipboardExpand all lines: src/api/api/inference.ts
+82Lines changed: 82 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -223,6 +223,21 @@ export default class Inference {
223
223
'timeout'
224
224
]
225
225
},
226
+
'inference.put_contextualai': {
227
+
path: [
228
+
'task_type',
229
+
'contextualai_inference_id'
230
+
],
231
+
body: [
232
+
'chunking_settings',
233
+
'service',
234
+
'service_settings',
235
+
'task_settings'
236
+
],
237
+
query: [
238
+
'timeout'
239
+
]
240
+
},
226
241
'inference.put_custom': {
227
242
path: [
228
243
'task_type',
@@ -1376,6 +1391,73 @@ export default class Inference {
1376
1391
returnawaitthis.transport.request({ path, method, querystring, body, meta },options)
1377
1392
}
1378
1393
1394
+
/**
1395
+
* Create an Contextual AI inference endpoint. Create an inference endpoint to perform an inference task with the `contexualai` service. To review the available `rerank` models, refer to <https://docs.contextual.ai/api-reference/rerank/rerank#body-model>.
1396
+
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-contextualai | Elasticsearch API documentation}
returnawaitthis.transport.request({ path, method, querystring, body, meta },options)
1459
+
}
1460
+
1379
1461
/**
1380
1462
* Create a custom inference endpoint. The custom service gives more control over how to interact with external inference services that aren't explicitly supported through dedicated integrations. The custom service gives you the ability to define the headers, url, query parameters, request body, and secrets. The custom service supports the template replacement functionality, which enables you to define a template that can be replaced with the value associated with that key. Templates are portions of a string that start with `${` and end with `}`. The parameters `secret_parameters` and `task_settings` are checked for keys for template replacement. Template replacement is supported in the `request`, `headers`, `url`, and `query_parameters`. If the definition (key) is not found for a template, an error message is returned. In case of an endpoint definition like the following: ``` PUT _inference/text_embedding/test-text-embedding { "service": "custom", "service_settings": { "secret_parameters": { "api_key": "<some api key>" }, "url": "...endpoints.huggingface.cloud/v1/embeddings", "headers": { "Authorization": "Bearer ${api_key}", "Content-Type": "application/json" }, "request": "{\"input\": ${input}}", "response": { "json_parser": { "text_embeddings":"$.data[*].embedding[*]" } } }} ``` To replace `${api_key}` the `secret_parameters` and `task_settings` are checked for a key named `api_key`. > info > Templates should not be surrounded by quotes. Pre-defined templates: * `${input}` refers to the array of input strings that comes from the `input` field of the subsequent inference requests. * `${input_type}` refers to the input type translation values. * `${query}` refers to the query field used specifically for reranking tasks. * `${top_n}` refers to the `top_n` field available when performing rerank requests. * `${return_documents}` refers to the `return_documents` field available when performing rerank requests.
1381
1463
* @see {@link https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-custom | Elasticsearch API documentation}
0 commit comments