Skip to content

Commit 5eb3554

Browse files
Auto-generated API code (#2577)
Co-authored-by: Josh Mock <[email protected]>
1 parent 26ce906 commit 5eb3554

File tree

100 files changed

+14354
-2613
lines changed

Some content is hidden

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

100 files changed

+14354
-2613
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.transport.request({
7+
method: "POST",
8+
path: "/_inference/chat_completion/openai-completion/_stream",
9+
body: {
10+
model: "gpt-4o",
11+
messages: [
12+
{
13+
role: "user",
14+
content: "What is Elastic?",
15+
},
16+
],
17+
},
18+
});
19+
console.log(response);
20+
----

Diff for: docs/doc_examples/ddaadd91b7743a1c7e946ce1b593cd1b.asciidoc renamed to docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33

44
[source, js]
55
----
6-
const response = await client.inference.inference({
6+
const response = await client.inference.put({
77
task_type: "my-inference-endpoint",
88
inference_id: "_update",
9-
service_settings: {
10-
api_key: "<API_KEY>",
9+
inference_config: {
10+
service_settings: {
11+
api_key: "<API_KEY>",
12+
},
1113
},
1214
});
1315
console.log(response);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.indices.create({
7+
index: "test-index",
8+
mappings: {
9+
properties: {
10+
source_field: {
11+
type: "text",
12+
fields: {
13+
infer_field: {
14+
type: "semantic_text",
15+
inference_id: ".elser-2-elasticsearch",
16+
},
17+
},
18+
},
19+
},
20+
},
21+
});
22+
console.log(response);
23+
----

Diff for: docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc

-10
This file was deleted.

Diff for: docs/doc_examples/38ba93890494bfa7beece58dffa44f98.asciidoc

-23
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.transport.request({
7+
method: "POST",
8+
path: "/_inference/chat_completion/openai-completion/_stream",
9+
body: {
10+
messages: [
11+
{
12+
role: "user",
13+
content: [
14+
{
15+
type: "text",
16+
text: "What's the price of a scarf?",
17+
},
18+
],
19+
},
20+
],
21+
tools: [
22+
{
23+
type: "function",
24+
function: {
25+
name: "get_current_price",
26+
description: "Get the current price of a item",
27+
parameters: {
28+
type: "object",
29+
properties: {
30+
item: {
31+
id: "123",
32+
},
33+
},
34+
},
35+
},
36+
},
37+
],
38+
tool_choice: {
39+
type: "function",
40+
function: {
41+
name: "get_current_price",
42+
},
43+
},
44+
},
45+
});
46+
console.log(response);
47+
----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.search({
7+
index: "image-index",
8+
knn: {
9+
field: "image-vector",
10+
query_vector: [-5, 9, -12],
11+
k: 10,
12+
num_candidates: 100,
13+
rescore_vector: {
14+
oversample: 2,
15+
},
16+
},
17+
fields: ["title", "file-type"],
18+
});
19+
console.log(response);
20+
----

Diff for: docs/doc_examples/ee05714a83d75fb6858e3b9fcbeb8f8b.asciidoc renamed to docs/doc_examples/681d24c2633f598fc43d6afff8996dbb.asciidoc

+6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@
55
----
66
const response = await client.indices.create({
77
index: "retrievers_example",
8+
settings: {
9+
number_of_shards: 1,
10+
},
811
mappings: {
912
properties: {
1013
vector: {
1114
type: "dense_vector",
1215
dims: 3,
1316
similarity: "l2_norm",
1417
index: true,
18+
index_options: {
19+
type: "flat",
20+
},
1521
},
1622
text: {
1723
type: "text",

Diff for: docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc renamed to docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
----
66
const response = await client.cluster.putSettings({
77
persistent: {
8-
"cluster.routing.allocation.disk.watermark.low": "30gb",
8+
"cluster.routing.allocation.disk.watermark.low": "90%",
9+
"cluster.routing.allocation.disk.watermark.high": "95%",
910
},
1011
});
1112
console.log(response);

Diff for: docs/doc_examples/93c77c65f1e11382f8043d0300e87b89.asciidoc renamed to docs/doc_examples/7bdc283b96c7a965fae23013647b8578.asciidoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ const response = await client.indices.create({
77
index: "test-index",
88
mappings: {
99
properties: {
10-
infer_field: {
11-
type: "semantic_text",
12-
inference_id: ".elser-2-elasticsearch",
13-
},
1410
source_field: {
1511
type: "text",
1612
copy_to: "infer_field",
1713
},
14+
infer_field: {
15+
type: "semantic_text",
16+
inference_id: ".elser-2-elasticsearch",
17+
},
1818
},
1919
},
2020
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// This file is autogenerated, DO NOT EDIT
2+
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
3+
4+
[source, js]
5+
----
6+
const response = await client.transport.request({
7+
method: "POST",
8+
path: "/_inference/chat_completion/openai-completion/_stream",
9+
body: {
10+
messages: [
11+
{
12+
role: "assistant",
13+
content: "Let's find out what the weather is",
14+
tool_calls: [
15+
{
16+
id: "call_KcAjWtAww20AihPHphUh46Gd",
17+
type: "function",
18+
function: {
19+
name: "get_current_weather",
20+
arguments: '{"location":"Boston, MA"}',
21+
},
22+
},
23+
],
24+
},
25+
{
26+
role: "tool",
27+
content: "The weather is cold",
28+
tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd",
29+
},
30+
],
31+
},
32+
});
33+
console.log(response);
34+
----

Diff for: docs/doc_examples/bee3fda7bb07086243424b62e5b16ca7.asciidoc renamed to docs/doc_examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
----
66
const response = await client.indices.create({
77
index: "retrievers_example_nested",
8+
settings: {
9+
number_of_shards: 1,
10+
},
811
mappings: {
912
properties: {
1013
nested_field: {
@@ -18,6 +21,9 @@ const response = await client.indices.create({
1821
dims: 3,
1922
similarity: "l2_norm",
2023
index: true,
24+
index_options: {
25+
type: "flat",
26+
},
2127
},
2228
},
2329
},

0 commit comments

Comments
 (0)