From 3627a4c56ba86794af2db65c817402739d8890ef Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Tue, 21 Jan 2025 19:07:51 +0000 Subject: [PATCH] Auto-generated API code (#2580) --- .../120fcf9f55128d6a81d5e87a9c235bbd.asciidoc | 20 ++++++++ ...141ef0ebaa3b0772892b79b9bb85efb0.asciidoc} | 8 ++-- .../31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc | 10 ---- .../45954b8aaedfed57012be8b6538b0a24.asciidoc | 47 +++++++++++++++++++ .../519e46350316a33162740e5d7968aa2c.asciidoc | 20 ++++++++ ...77cebba946fe648873a1e7375c13df41.asciidoc} | 3 +- .../82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc | 34 ++++++++++++++ src/api/types.ts | 2 +- src/api/typesWithBodyKey.ts | 2 +- 9 files changed, 130 insertions(+), 16 deletions(-) create mode 100644 docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc rename docs/doc_examples/{ddaadd91b7743a1c7e946ce1b593cd1b.asciidoc => 141ef0ebaa3b0772892b79b9bb85efb0.asciidoc} (65%) delete mode 100644 docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc create mode 100644 docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc create mode 100644 docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc rename docs/doc_examples/{9d47f02a063444da9f098858a1830d28.asciidoc => 77cebba946fe648873a1e7375c13df41.asciidoc} (66%) create mode 100644 docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc diff --git a/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc b/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc new file mode 100644 index 000000000..f6c1cb881 --- /dev/null +++ b/docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc @@ -0,0 +1,20 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.transport.request({ + method: "POST", + path: "/_inference/chat_completion/openai-completion/_stream", + body: { + model: "gpt-4o", + messages: [ + { + role: "user", + content: "What is Elastic?", + }, + ], + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/ddaadd91b7743a1c7e946ce1b593cd1b.asciidoc b/docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc similarity index 65% rename from docs/doc_examples/ddaadd91b7743a1c7e946ce1b593cd1b.asciidoc rename to docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc index bd9c35360..7d7aeab98 100644 --- a/docs/doc_examples/ddaadd91b7743a1c7e946ce1b593cd1b.asciidoc +++ b/docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc @@ -3,11 +3,13 @@ [source, js] ---- -const response = await client.inference.inference({ +const response = await client.inference.put({ task_type: "my-inference-endpoint", inference_id: "_update", - service_settings: { - api_key: "", + inference_config: { + service_settings: { + api_key: "", + }, }, }); console.log(response); diff --git a/docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc b/docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc deleted file mode 100644 index 36c1c5a79..000000000 --- a/docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// Use `node scripts/generate-docs-examples.js` to generate the docs examples - -[source, js] ----- -const response = await client.indices.unfreeze({ - index: "my-index-000001", -}); -console.log(response); ----- diff --git a/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc b/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc new file mode 100644 index 000000000..a2ff623e6 --- /dev/null +++ b/docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc @@ -0,0 +1,47 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.transport.request({ + method: "POST", + path: "/_inference/chat_completion/openai-completion/_stream", + body: { + messages: [ + { + role: "user", + content: [ + { + type: "text", + text: "What's the price of a scarf?", + }, + ], + }, + ], + tools: [ + { + type: "function", + function: { + name: "get_current_price", + description: "Get the current price of a item", + parameters: { + type: "object", + properties: { + item: { + id: "123", + }, + }, + }, + }, + }, + ], + tool_choice: { + type: "function", + function: { + name: "get_current_price", + }, + }, + }, +}); +console.log(response); +---- diff --git a/docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc b/docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc new file mode 100644 index 000000000..3c92986f6 --- /dev/null +++ b/docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc @@ -0,0 +1,20 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.search({ + index: "image-index", + knn: { + field: "image-vector", + query_vector: [-5, 9, -12], + k: 10, + num_candidates: 100, + rescore_vector: { + oversample: 2, + }, + }, + fields: ["title", "file-type"], +}); +console.log(response); +---- diff --git a/docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc b/docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc similarity index 66% rename from docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc rename to docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc index b10da9a05..a09e089bb 100644 --- a/docs/doc_examples/9d47f02a063444da9f098858a1830d28.asciidoc +++ b/docs/doc_examples/77cebba946fe648873a1e7375c13df41.asciidoc @@ -5,7 +5,8 @@ ---- const response = await client.cluster.putSettings({ persistent: { - "cluster.routing.allocation.disk.watermark.low": "30gb", + "cluster.routing.allocation.disk.watermark.low": "90%", + "cluster.routing.allocation.disk.watermark.high": "95%", }, }); console.log(response); diff --git a/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc b/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc new file mode 100644 index 000000000..7c7a7cba1 --- /dev/null +++ b/docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc @@ -0,0 +1,34 @@ +// This file is autogenerated, DO NOT EDIT +// Use `node scripts/generate-docs-examples.js` to generate the docs examples + +[source, js] +---- +const response = await client.transport.request({ + method: "POST", + path: "/_inference/chat_completion/openai-completion/_stream", + body: { + messages: [ + { + role: "assistant", + content: "Let's find out what the weather is", + tool_calls: [ + { + id: "call_KcAjWtAww20AihPHphUh46Gd", + type: "function", + function: { + name: "get_current_weather", + arguments: '{"location":"Boston, MA"}', + }, + }, + ], + }, + { + role: "tool", + content: "The weather is cold", + tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd", + }, + ], + }, +}); +console.log(response); +---- diff --git a/src/api/types.ts b/src/api/types.ts index 9a41a6c51..7fb512bb7 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -6894,7 +6894,7 @@ export type CatAllocationResponse = CatAllocationAllocationRecord[] export interface CatComponentTemplatesComponentTemplate { name: string - version: string + version: string | null alias_count: string mapping_count: string settings_count: string diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index c0beccfa3..23e05adef 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -6974,7 +6974,7 @@ export type CatAllocationResponse = CatAllocationAllocationRecord[] export interface CatComponentTemplatesComponentTemplate { name: string - version: string + version: string | null alias_count: string mapping_count: string settings_count: string