Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions docs/doc_examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@

[source, js]
----
const response = await client.inference.streamInference({
task_type: "chat_completion",
const response = await client.inference.chatCompletionUnified({
inference_id: "openai-completion",
model: "gpt-4o",
messages: [
{
role: "user",
content: "What is Elastic?",
},
],
chat_completion_request: {
model: "gpt-4o",
messages: [
{
role: "user",
content: "What is Elastic?",
},
],
},
});
console.log(response);
----
3 changes: 1 addition & 2 deletions docs/doc_examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

[source, js]
----
const response = await client.inference.inference({
task_type: "sparse_embedding",
const response = await client.inference.sparseEmbedding({
inference_id: "my-elser-model",
input:
"The sky above the port was the color of television tuned to a dead channel.",
Expand Down
59 changes: 30 additions & 29 deletions docs/doc_examples/45954b8aaedfed57012be8b6538b0a24.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,43 @@

[source, js]
----
const response = await client.inference.streamInference({
task_type: "chat_completion",
const response = await client.inference.chatCompletionUnified({
inference_id: "openai-completion",
messages: [
{
role: "user",
content: [
{
type: "text",
text: "What's the price of a scarf?",
chat_completion_request: {
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",
},
},
},
},
],
},
],
tools: [
{
},
],
tool_choice: {
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);
Expand Down
3 changes: 1 addition & 2 deletions docs/doc_examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

[source, js]
----
const response = await client.inference.streamInference({
task_type: "completion",
const response = await client.inference.streamCompletion({
inference_id: "openai-completion",
input: "What is Elastic?",
});
Expand Down
3 changes: 1 addition & 2 deletions docs/doc_examples/7429b16221fe741fd31b0584786dd0b0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

[source, js]
----
const response = await client.inference.inference({
task_type: "text_embedding",
const response = await client.inference.textEmbedding({
inference_id: "my-cohere-endpoint",
input:
"The sky above the port was the color of television tuned to a dead channel.",
Expand Down
45 changes: 23 additions & 22 deletions docs/doc_examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@

[source, js]
----
const response = await client.inference.streamInference({
task_type: "chat_completion",
const response = await client.inference.chatCompletionUnified({
inference_id: "openai-completion",
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"}',
chat_completion_request: {
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",
},
],
],
},
{
role: "tool",
content: "The weather is cold",
tool_call_id: "call_KcAjWtAww20AihPHphUh46Gd",
},
],
},
});
console.log(response);
----
3 changes: 1 addition & 2 deletions docs/doc_examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

[source, js]
----
const response = await client.inference.inference({
task_type: "completion",
const response = await client.inference.completion({
inference_id: "openai_chat_completions",
input: "What is Elastic?",
});
Expand Down
3 changes: 1 addition & 2 deletions docs/doc_examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

[source, js]
----
const response = await client.inference.inference({
task_type: "rerank",
const response = await client.inference.rerank({
inference_id: "cohere_rerank",
input: ["luke", "like", "leia", "chewy", "r2d2", "star", "wars"],
query: "star wars main character",
Expand Down