Skip to content

Commit 913d585

Browse files
committed
eis chat completion and unified cc request refactor
1 parent 00a28c4 commit 913d585

File tree

10 files changed

+460
-1375
lines changed

10 files changed

+460
-1375
lines changed

output/openapi/elasticsearch-openapi.json

+29-322
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/openapi/elasticsearch-serverless-openapi.json

+29-322
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema-serverless.json

+156-321
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

+156-321
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/validation-errors.json

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@
5656
],
5757
"response": []
5858
},
59+
"inference.post_eis_chat_completion": {
60+
"request": [
61+
"Request: url path '/_inference/{task_type}/{eis_inference_id}/_stream' not found in the json spec"
62+
],
63+
"response": []
64+
},
5965
"ingest.get_ip_location_database": {
6066
"request": [
6167
"Request: query parameter 'master_timeout' does not exist in the json spec"

output/typescript/types.ts

+16-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_json_spec/inference.post.eis_chat_completion.json specification/_json_spec/inference.post_eis_chat_completion.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"inference.post.eis_chat_completion": {
2+
"inference.post_eis_chat_completion": {
33
"documentation": {
44
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html",
55
"description": "Perform a chat completion task via the Elastic Inference Service (EIS)"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
import {
21+
CompletionTool,
22+
CompletionToolType,
23+
Message
24+
} from '@inference/chat_completion_unified/UnifiedRequest'
25+
import { RequestBase } from '@_types/Base'
26+
import { float, long } from '@_types/Numeric'
27+
28+
export interface RequestChatCompletionBase extends RequestBase {
29+
/**
30+
* A list of objects representing the conversation.
31+
*/
32+
messages: Array<Message>
33+
/**
34+
* The ID of the model to use.
35+
*/
36+
model?: string
37+
/**
38+
* The upper bound limit for the number of tokens that can be generated for a completion request.
39+
*/
40+
max_completion_tokens?: long
41+
/**
42+
* A sequence of strings to control when the model should stop generating additional tokens.
43+
*/
44+
stop?: Array<string>
45+
/**
46+
* The sampling temperature to use.
47+
*/
48+
temperature?: float
49+
/**
50+
* Controls which tool is called by the model.
51+
*/
52+
tool_choice?: CompletionToolType
53+
/**
54+
* A list of tools that the model can call.
55+
*/
56+
tools?: Array<CompletionTool>
57+
/**
58+
* Nucleus sampling, an alternative to sampling with temperature.
59+
*/
60+
top_p?: float
61+
}

specification/inference/chat_completion_unified/UnifiedRequest.ts

+2-37
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
* under the License.
1818
*/
1919

20+
import { RequestChatCompletionBase } from '@inference/_types/CommonTypes'
2021
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
21-
import { RequestBase } from '@_types/Base'
2222
import { Id } from '@_types/common'
23-
import { float, long } from '@_types/Numeric'
2423
import { Duration } from '@_types/Time'
2524

2625
/**
@@ -30,7 +29,7 @@ import { Duration } from '@_types/Time'
3029
* @availability serverless stability=stable visibility=public
3130
* @doc_id inference-api-chat-completion
3231
*/
33-
export interface Request extends RequestBase {
32+
export interface Request extends RequestChatCompletionBase {
3433
urls: [
3534
{
3635
path: '/_inference/chat_completion/{inference_id}/_stream'
@@ -50,40 +49,6 @@ export interface Request extends RequestBase {
5049
*/
5150
timeout?: Duration
5251
}
53-
body: {
54-
/**
55-
* A list of objects representing the conversation.
56-
*/
57-
messages: Array<Message>
58-
/**
59-
* The ID of the model to use.
60-
*/
61-
model?: string
62-
/**
63-
* The upper bound limit for the number of tokens that can be generated for a completion request.
64-
*/
65-
max_completion_tokens?: long
66-
/**
67-
* A sequence of strings to control when the model should stop generating additional tokens.
68-
*/
69-
stop?: Array<string>
70-
/**
71-
* The sampling temperature to use.
72-
*/
73-
temperature?: float
74-
/**
75-
* Controls which tool is called by the model.
76-
*/
77-
tool_choice?: CompletionToolType
78-
/**
79-
* A list of tools that the model can call.
80-
*/
81-
tools?: Array<CompletionTool>
82-
/**
83-
* Nucleus sampling, an alternative to sampling with temperature.
84-
*/
85-
top_p?: float
86-
}
8752
}
8853

8954
/**

specification/inference/post_eis_chat_completion/PostEisChatCompletionRequest.ts

+4-16
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,30 @@
1717
* under the License.
1818
*/
1919

20-
import type { Request as RequestChatCompletion } from '../chat_completion_unified/UnifiedRequest'
20+
import { RequestChatCompletionBase } from '@inference/_types/CommonTypes'
2121
import { Id } from '@_types/common'
2222

23-
24-
export type OmittedChatCompletion = Omit<RequestChatCompletion, 'urls' | 'path_parts'>;
25-
2623
/**
2724
* Perform a chat completion task through the Elastic Inference Service (EIS).
2825
*
2926
* Perform a chat completion inference task with the `elastic` service.
30-
* @rest_spec_name inference.post.eis_chat_completion
27+
* @rest_spec_name inference.post_eis_chat_completion
3128
* @availability stack since=9.0.0 stability=stable visibility=public
3229
* @availability serverless stability=stable visibility=public
3330
* @cluster_privileges manage_inference
3431
* @doc_id inference-api-post-eis-chat-completion
3532
*/
36-
export interface Request extends OmittedChatCompletion {
33+
export interface Request extends RequestChatCompletionBase {
3734
urls: [
3835
{
39-
path: '/_inference/{task_type}/{eis_inference_id}/_stream'
36+
path: '/_inference/chat_completion/{eis_inference_id}/_stream'
4037
methods: ['POST']
4138
}
4239
]
4340
path_parts: {
44-
/**
45-
* The type of the inference task that the model will perform.
46-
*/
47-
task_type: EisTaskType
4841
/**
4942
* The unique identifier of the inference endpoint.
5043
*/
5144
eis_inference_id: Id
5245
}
5346
}
54-
55-
export enum EisTaskType {
56-
chat_completion
57-
}
58-

0 commit comments

Comments
 (0)