Auto-generated API code (#2707)
This commit is contained in:
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.streamInference({
|
const response = await client.inference.chatCompletionUnified({
|
||||||
task_type: "chat_completion",
|
|
||||||
inference_id: "openai-completion",
|
inference_id: "openai-completion",
|
||||||
|
chat_completion_request: {
|
||||||
model: "gpt-4o",
|
model: "gpt-4o",
|
||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
@ -13,6 +13,7 @@ const response = await client.inference.streamInference({
|
|||||||
content: "What is Elastic?",
|
content: "What is Elastic?",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.inference({
|
const response = await client.inference.sparseEmbedding({
|
||||||
task_type: "sparse_embedding",
|
|
||||||
inference_id: "my-elser-model",
|
inference_id: "my-elser-model",
|
||||||
input:
|
input:
|
||||||
"The sky above the port was the color of television tuned to a dead channel.",
|
"The sky above the port was the color of television tuned to a dead channel.",
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.streamInference({
|
const response = await client.inference.chatCompletionUnified({
|
||||||
task_type: "chat_completion",
|
|
||||||
inference_id: "openai-completion",
|
inference_id: "openai-completion",
|
||||||
|
chat_completion_request: {
|
||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
role: "user",
|
role: "user",
|
||||||
@ -40,6 +40,7 @@ const response = await client.inference.streamInference({
|
|||||||
name: "get_current_price",
|
name: "get_current_price",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.streamInference({
|
const response = await client.inference.streamCompletion({
|
||||||
task_type: "completion",
|
|
||||||
inference_id: "openai-completion",
|
inference_id: "openai-completion",
|
||||||
input: "What is Elastic?",
|
input: "What is Elastic?",
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.inference({
|
const response = await client.inference.textEmbedding({
|
||||||
task_type: "text_embedding",
|
|
||||||
inference_id: "my-cohere-endpoint",
|
inference_id: "my-cohere-endpoint",
|
||||||
input:
|
input:
|
||||||
"The sky above the port was the color of television tuned to a dead channel.",
|
"The sky above the port was the color of television tuned to a dead channel.",
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.streamInference({
|
const response = await client.inference.chatCompletionUnified({
|
||||||
task_type: "chat_completion",
|
|
||||||
inference_id: "openai-completion",
|
inference_id: "openai-completion",
|
||||||
|
chat_completion_request: {
|
||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
role: "assistant",
|
role: "assistant",
|
||||||
@ -27,6 +27,7 @@ const response = await client.inference.streamInference({
|
|||||||
tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd",
|
tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
console.log(response);
|
console.log(response);
|
||||||
----
|
----
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.inference({
|
const response = await client.inference.completion({
|
||||||
task_type: "completion",
|
|
||||||
inference_id: "openai_chat_completions",
|
inference_id: "openai_chat_completions",
|
||||||
input: "What is Elastic?",
|
input: "What is Elastic?",
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
[source, js]
|
[source, js]
|
||||||
----
|
----
|
||||||
const response = await client.inference.inference({
|
const response = await client.inference.rerank({
|
||||||
task_type: "rerank",
|
|
||||||
inference_id: "cohere_rerank",
|
inference_id: "cohere_rerank",
|
||||||
input: ["luke", "like", "leia", "chewy", "r2d2", "star", "wars"],
|
input: ["luke", "like", "leia", "chewy", "r2d2", "star", "wars"],
|
||||||
query: "star wars main character",
|
query: "star wars main character",
|
||||||
|
|||||||
Reference in New Issue
Block a user