Skip to content

Commit

Permalink
Auto-generated API code
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Jan 20, 2025
1 parent fecda56 commit 1e9571c
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 16 deletions.
20 changes: 20 additions & 0 deletions docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<API_KEY>",
inference_config: {
service_settings: {
api_key: "<API_KEY>",
},
},
});
console.log(response);
Expand Down
10 changes: 0 additions & 10 deletions docs/doc_examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc

This file was deleted.

47 changes: 47 additions & 0 deletions docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
20 changes: 20 additions & 0 deletions docs/doc_examples/519e46350316a33162740e5d7968aa2c.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
34 changes: 34 additions & 0 deletions docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc
Original file line number Diff line number Diff line change
@@ -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);
----
2 changes: 1 addition & 1 deletion src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/api/typesWithBodyKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1e9571c

Please sign in to comment.