Skip to content

Auto-generated code for main #2714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
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
5 changes: 2 additions & 3 deletions docs/doc_examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

[source, js]
----
const response = await client.inference.put({
task_type: "my-inference-endpoint",
inference_id: "_update",
const response = await client.inference.update({
inference_id: "my-inference-endpoint",
inference_config: {
service_settings: {
api_key: "<API_KEY>",
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
37 changes: 0 additions & 37 deletions docs/reference/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7553,23 +7553,6 @@ client.inference.get({ ... })
- **`task_type` (Optional, Enum("sparse_embedding" | "text_embedding" | "rerank" | "completion" | "chat_completion"))**: The task type
- **`inference_id` (Optional, string)**: The inference Id

## client.inference.postEisChatCompletion [_inference.post_eis_chat_completion]
Perform a chat completion task through the Elastic Inference Service (EIS).

Perform a chat completion inference task with the `elastic` service.

[Endpoint documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-post-eis-chat-completion)

```ts
client.inference.postEisChatCompletion({ eis_inference_id })
```

### Arguments [_arguments_inference.post_eis_chat_completion]

#### Request (object) [_request_inference.post_eis_chat_completion]
- **`eis_inference_id` (string)**: The unique identifier of the inference endpoint.
- **`chat_completion_request` (Optional, { messages, model, max_completion_tokens, stop, temperature, tool_choice, tools, top_p })**

## client.inference.put [_inference.put]
Create an inference endpoint.
When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.
Expand Down Expand Up @@ -7776,26 +7759,6 @@ These settings are specific to the `cohere` service.
- **`task_settings` (Optional, { input_type, return_documents, top_n, truncate })**: Settings to configure the inference task.
These settings are specific to the task type you specified.

## client.inference.putEis [_inference.put_eis]
Create an Elastic Inference Service (EIS) inference endpoint.

Create an inference endpoint to perform an inference task through the Elastic Inference Service (EIS).

[Endpoint documentation](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-eis)

```ts
client.inference.putEis({ task_type, eis_inference_id, service, service_settings })
```

### Arguments [_arguments_inference.put_eis]

#### Request (object) [_request_inference.put_eis]
- **`task_type` (Enum("chat_completion"))**: The type of the inference task that the model will perform.
NOTE: The `chat_completion` task type only supports streaming and only through the _stream API.
- **`eis_inference_id` (string)**: The unique identifier of the inference endpoint.
- **`service` (Enum("elastic"))**: The type of service supported for the specified task type. In this case, `elastic`.
- **`service_settings` ({ model_id, rate_limit })**: Settings used to install the inference model. These settings are specific to the `elastic` service.

## client.inference.putElasticsearch [_inference.put_elasticsearch]
Create an Elasticsearch inference endpoint.

Expand Down
Loading