Skip to content
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

Adds EIS POST inference details #3940

Merged
merged 7 commits into from
Mar 24, 2025
Merged

Adds EIS POST inference details #3940

merged 7 commits into from
Mar 24, 2025

Conversation

szabosteve
Copy link
Contributor

Overview

This PR adds the EIS POST inference API use case.

Copy link
Contributor

Following you can find the validation results for the APIs you have changed.

API Status Request Response
inference.post_eis Missing test Missing test

You can validate these APIs yourself by using the make validate target.

@szabosteve szabosteve marked this pull request as ready for review March 12, 2025 12:08
@szabosteve szabosteve requested review from a team as code owners March 12, 2025 12:08
Copy link
Contributor

Following you can find the validation results for the APIs you have changed.

API Status Request Response
inference.post_eis Missing test Missing test

You can validate these APIs yourself by using the make validate target.

import { Id } from '@_types/common'


export type OmittedChatCompletion = Omit<RequestChatCompletion, 'urls' | 'path_parts'>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swallez @pquentin we're trying to override the urls and path_parts, we're getting errors when trying to run make generate. Is this a valid solution?

Technically we don't really have to do this, I'm just curious if it's possible. UnifiedRequest will likely be identical to the Request interface we're defining in this file. We are trying to rename the inference_id path part to eis_inference_id just to make the documentation a little clearer.

Copy link
Contributor

@jonathan-buttner jonathan-buttner Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option seems to work:

import type { Request as RequestChatCompletion } from '../chat_completion_unified/UnifiedRequest'

export interface Request extends RequestChatCompletion {}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have a RequestChatCompletionBase and extend it in different APIs, which is close to what your last comment does, but Omit won't work indeed. It's also OK to repeat yourself here.

"path": "/_inference/chat_completion/{eis_inference_id}/_stream",
"methods": ["POST"],
"parts": {
"task_type": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove the task_type object since we've defined chat_completion in the URL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the idea is to define a task type and use it as a variable because we don't know whether new tasks will be added, so we want to already have the structure prepared for the future

import { Id } from '@_types/common'


export type OmittedChatCompletion = Omit<RequestChatCompletion, 'urls' | 'path_parts'>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like this is going to work, so either copying the whole UnifiedRequest or creating an interface that contains the fields that are shared between UnifiedRequest and this file excluding urls and path_parts.

@l-trotta l-trotta force-pushed the szabosteve/eis-inference branch from bfa783d to 913d585 Compare March 24, 2025 11:37
Copy link
Contributor

Following you can find the validation results for the APIs you have changed.

API Status Request Response
inference.chat_completion_unified Missing test Missing test
inference.completion Missing test Missing test
inference.delete Missing test Missing test
inference.get 🟢 1/1 1/1
inference.post_eis_chat_completion Missing test Missing test
inference.put_eis Missing test Missing test
inference.put_mistral 🟠 Missing type Missing type
inference.put_openai Missing test Missing test
inference.put_voyageai Missing test Missing test
inference.put_watsonx Missing test Missing test
inference.put Missing test Missing test
inference.rerank Missing test Missing test
inference.sparse_embedding Missing test Missing test
inference.stream_completion Missing test Missing test
inference.text_embedding Missing test Missing test
inference.update Missing test Missing test

You can validate these APIs yourself by using the make validate target.

@l-trotta
Copy link
Contributor

Made some changes:

  • changed api def from inference.post.eis_chat_completion to inference.post_eis_chat_completion
  • created RequestChatCompletionBase to be extended, made Eis and UnifiedRequeste extend it
  • removed the path parameter {task_type} since this endpoint will be specific for eis chat completion

@@ -56,6 +56,12 @@
],
"response": []
},
"inference.post_eis_chat_completion": {
"request": [
"Request: url path '/_inference/{task_type}/{eis_inference_id}/_stream' not found in the json spec"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I wonder why we're getting this validation error now 🤔 Is it because we only define a chat_completion task type in the types?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to regenerate output after path fix ^^" also needed to fix the json spec accordingly, pushing a fix now

Copy link
Contributor

Following you can find the validation results for the APIs you have changed.

API Status Request Response
inference.chat_completion_unified Missing test Missing test
inference.completion Missing test Missing test
inference.delete Missing test Missing test
inference.get 🟢 1/1 1/1
inference.post_eis_chat_completion Missing test Missing test
inference.put_eis Missing test Missing test
inference.put_mistral 🟠 Missing type Missing type
inference.put_openai Missing test Missing test
inference.put_voyageai Missing test Missing test
inference.put_watsonx Missing test Missing test
inference.put Missing test Missing test
inference.rerank Missing test Missing test
inference.sparse_embedding Missing test Missing test
inference.stream_completion Missing test Missing test
inference.text_embedding Missing test Missing test
inference.update Missing test Missing test

You can validate these APIs yourself by using the make validate target.

@szabosteve szabosteve merged commit f729638 into main Mar 24, 2025
8 checks passed
@szabosteve szabosteve deleted the szabosteve/eis-inference branch March 24, 2025 13:19
Copy link
Contributor

The backport to 8.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.x 8.x
# Navigate to the new working tree
cd .worktrees/backport-8.x
# Create a new branch
git switch --create backport-3940-to-8.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f729638171c6269ed25f626f478c8520e2db5ccf
# Push it to GitHub
git push --set-upstream origin backport-3940-to-8.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.x

Then, create a pull request where the base branch is 8.x and the compare/head branch is backport-3940-to-8.x.

Copy link
Contributor

The backport to 8.18 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.18 8.18
# Navigate to the new working tree
cd .worktrees/backport-8.18
# Create a new branch
git switch --create backport-3940-to-8.18
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f729638171c6269ed25f626f478c8520e2db5ccf
# Push it to GitHub
git push --set-upstream origin backport-3940-to-8.18
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.18

Then, create a pull request where the base branch is 8.18 and the compare/head branch is backport-3940-to-8.18.

Copy link
Contributor

The backport to 9.0 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-9.0 9.0
# Navigate to the new working tree
cd .worktrees/backport-9.0
# Create a new branch
git switch --create backport-3940-to-9.0
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f729638171c6269ed25f626f478c8520e2db5ccf
# Push it to GitHub
git push --set-upstream origin backport-3940-to-9.0
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-9.0

Then, create a pull request where the base branch is 9.0 and the compare/head branch is backport-3940-to-9.0.

szabosteve added a commit that referenced this pull request Mar 24, 2025
Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>
Co-authored-by: Laura Trotta <laura.trotta@elastic.co>
szabosteve added a commit that referenced this pull request Mar 24, 2025
* Adds EIS POST inference details (#3940)

Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>
Co-authored-by: Laura Trotta <laura.trotta@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants