Skip to content

Commit c49af58

Browse files
committed
Revert "temp rebase fix"
This reverts commit 48f2b57.
1 parent 538e7eb commit c49af58

File tree

155 files changed

+30856
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+30856
-0
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
import co.elastic.clients.elasticsearch.graph.ElasticsearchGraphAsyncClient;
121121
import co.elastic.clients.elasticsearch.ilm.ElasticsearchIlmAsyncClient;
122122
import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesAsyncClient;
123+
import co.elastic.clients.elasticsearch.inference.ElasticsearchInferenceAsyncClient;
123124
import co.elastic.clients.elasticsearch.ingest.ElasticsearchIngestAsyncClient;
124125
import co.elastic.clients.elasticsearch.license.ElasticsearchLicenseAsyncClient;
125126
import co.elastic.clients.elasticsearch.logstash.ElasticsearchLogstashAsyncClient;
@@ -264,6 +265,10 @@ public ElasticsearchIndicesAsyncClient indices() {
264265
return new ElasticsearchIndicesAsyncClient(this.transport, this.transportOptions);
265266
}
266267

268+
public ElasticsearchInferenceAsyncClient inference() {
269+
return new ElasticsearchInferenceAsyncClient(this.transport, this.transportOptions);
270+
}
271+
267272
public ElasticsearchIngestAsyncClient ingest() {
268273
return new ElasticsearchIngestAsyncClient(this.transport, this.transportOptions);
269274
}

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
import co.elastic.clients.elasticsearch.graph.ElasticsearchGraphClient;
122122
import co.elastic.clients.elasticsearch.ilm.ElasticsearchIlmClient;
123123
import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient;
124+
import co.elastic.clients.elasticsearch.inference.ElasticsearchInferenceClient;
124125
import co.elastic.clients.elasticsearch.ingest.ElasticsearchIngestClient;
125126
import co.elastic.clients.elasticsearch.license.ElasticsearchLicenseClient;
126127
import co.elastic.clients.elasticsearch.logstash.ElasticsearchLogstashClient;
@@ -264,6 +265,10 @@ public ElasticsearchIndicesClient indices() {
264265
return new ElasticsearchIndicesClient(this.transport, this.transportOptions);
265266
}
266267

268+
public ElasticsearchInferenceClient inference() {
269+
return new ElasticsearchInferenceClient(this.transport, this.transportOptions);
270+
}
271+
267272
public ElasticsearchIngestClient ingest() {
268273
return new ElasticsearchIngestClient(this.transport, this.transportOptions);
269274
}
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
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+
package co.elastic.clients.elasticsearch.inference;
21+
22+
import co.elastic.clients.elasticsearch._types.ErrorResponse;
23+
import co.elastic.clients.elasticsearch._types.Time;
24+
import co.elastic.clients.json.JsonpDeserializable;
25+
import co.elastic.clients.json.JsonpDeserializer;
26+
import co.elastic.clients.json.ObjectBuilderDeserializer;
27+
import co.elastic.clients.json.ObjectDeserializer;
28+
import co.elastic.clients.transport.Endpoint;
29+
import co.elastic.clients.transport.endpoints.BinaryEndpoint;
30+
import co.elastic.clients.transport.endpoints.BinaryResponse;
31+
import co.elastic.clients.transport.endpoints.SimpleEndpoint;
32+
import co.elastic.clients.util.ApiTypeHelper;
33+
import co.elastic.clients.util.ObjectBuilder;
34+
import jakarta.json.stream.JsonGenerator;
35+
import java.lang.String;
36+
import java.util.HashMap;
37+
import java.util.Map;
38+
import java.util.Objects;
39+
import java.util.function.Function;
40+
import javax.annotation.Nullable;
41+
42+
//----------------------------------------------------------------
43+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
44+
//----------------------------------------------------------------
45+
//
46+
// This code is generated from the Elasticsearch API specification
47+
// at https://github.com/elastic/elasticsearch-specification
48+
//
49+
// Manual updates to this file will be lost when the code is
50+
// re-generated.
51+
//
52+
// If you find a property that is missing or wrongly typed, please
53+
// open an issue or a PR on the API specification repository.
54+
//
55+
//----------------------------------------------------------------
56+
57+
// typedef: inference.chat_completion_unified.Request
58+
59+
/**
60+
* Perform chat completion inference
61+
*
62+
* @see <a href=
63+
* "../doc-files/api-spec.html#inference.chat_completion_unified.Request">API
64+
* specification</a>
65+
*/
66+
@JsonpDeserializable
67+
public class ChatCompletionUnifiedRequest extends RequestChatCompletionBase {
68+
private final String inferenceId;
69+
70+
@Nullable
71+
private final Time timeout;
72+
73+
// ---------------------------------------------------------------------------------------------
74+
75+
private ChatCompletionUnifiedRequest(Builder builder) {
76+
super(builder);
77+
78+
this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId");
79+
this.timeout = builder.timeout;
80+
81+
}
82+
83+
public static ChatCompletionUnifiedRequest of(Function<Builder, ObjectBuilder<ChatCompletionUnifiedRequest>> fn) {
84+
return fn.apply(new Builder()).build();
85+
}
86+
87+
/**
88+
* Required - The inference Id
89+
* <p>
90+
* API name: {@code inference_id}
91+
*/
92+
public final String inferenceId() {
93+
return this.inferenceId;
94+
}
95+
96+
/**
97+
* Specifies the amount of time to wait for the inference request to complete.
98+
* <p>
99+
* API name: {@code timeout}
100+
*/
101+
@Nullable
102+
public final Time timeout() {
103+
return this.timeout;
104+
}
105+
106+
// ---------------------------------------------------------------------------------------------
107+
108+
/**
109+
* Builder for {@link ChatCompletionUnifiedRequest}.
110+
*/
111+
112+
public static class Builder extends RequestChatCompletionBase.AbstractBuilder<Builder>
113+
implements
114+
ObjectBuilder<ChatCompletionUnifiedRequest> {
115+
private String inferenceId;
116+
117+
@Nullable
118+
private Time timeout;
119+
120+
/**
121+
* Required - The inference Id
122+
* <p>
123+
* API name: {@code inference_id}
124+
*/
125+
public final Builder inferenceId(String value) {
126+
this.inferenceId = value;
127+
return this;
128+
}
129+
130+
/**
131+
* Specifies the amount of time to wait for the inference request to complete.
132+
* <p>
133+
* API name: {@code timeout}
134+
*/
135+
public final Builder timeout(@Nullable Time value) {
136+
this.timeout = value;
137+
return this;
138+
}
139+
140+
/**
141+
* Specifies the amount of time to wait for the inference request to complete.
142+
* <p>
143+
* API name: {@code timeout}
144+
*/
145+
public final Builder timeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
146+
return this.timeout(fn.apply(new Time.Builder()).build());
147+
}
148+
149+
@Override
150+
protected Builder self() {
151+
return this;
152+
}
153+
154+
/**
155+
* Builds a {@link ChatCompletionUnifiedRequest}.
156+
*
157+
* @throws NullPointerException
158+
* if some of the required fields are null.
159+
*/
160+
public ChatCompletionUnifiedRequest build() {
161+
_checkSingleUse();
162+
163+
return new ChatCompletionUnifiedRequest(this);
164+
}
165+
}
166+
167+
// ---------------------------------------------------------------------------------------------
168+
169+
/**
170+
* Json deserializer for {@link ChatCompletionUnifiedRequest}
171+
*/
172+
public static final JsonpDeserializer<ChatCompletionUnifiedRequest> _DESERIALIZER = ObjectBuilderDeserializer
173+
.lazy(Builder::new, ChatCompletionUnifiedRequest::setupChatCompletionUnifiedRequestDeserializer);
174+
175+
protected static void setupChatCompletionUnifiedRequestDeserializer(
176+
ObjectDeserializer<ChatCompletionUnifiedRequest.Builder> op) {
177+
RequestChatCompletionBase.setupRequestChatCompletionBaseDeserializer(op);
178+
179+
}
180+
181+
// ---------------------------------------------------------------------------------------------
182+
183+
/**
184+
* Endpoint "{@code inference.chat_completion_unified}".
185+
*/
186+
public static final Endpoint<ChatCompletionUnifiedRequest, BinaryResponse, ErrorResponse> _ENDPOINT = new BinaryEndpoint<>(
187+
"es/inference.chat_completion_unified",
188+
189+
// Request method
190+
request -> {
191+
return "POST";
192+
193+
},
194+
195+
// Request path
196+
request -> {
197+
final int _inferenceId = 1 << 0;
198+
199+
int propsSet = 0;
200+
201+
propsSet |= _inferenceId;
202+
203+
if (propsSet == (_inferenceId)) {
204+
StringBuilder buf = new StringBuilder();
205+
buf.append("/_inference");
206+
buf.append("/chat_completion");
207+
buf.append("/");
208+
SimpleEndpoint.pathEncode(request.inferenceId, buf);
209+
buf.append("/_stream");
210+
return buf.toString();
211+
}
212+
throw SimpleEndpoint.noPathTemplateFound("path");
213+
214+
},
215+
216+
// Path parameters
217+
request -> {
218+
Map<String, String> params = new HashMap<>();
219+
final int _inferenceId = 1 << 0;
220+
221+
int propsSet = 0;
222+
223+
propsSet |= _inferenceId;
224+
225+
if (propsSet == (_inferenceId)) {
226+
params.put("inferenceId", request.inferenceId);
227+
}
228+
return params;
229+
},
230+
231+
// Request parameters
232+
request -> {
233+
Map<String, String> params = new HashMap<>();
234+
if (request.timeout != null) {
235+
params.put("timeout", request.timeout._toJsonString());
236+
}
237+
return params;
238+
239+
}, SimpleEndpoint.emptyMap(), true, null);
240+
}

0 commit comments

Comments
 (0)