-
Notifications
You must be signed in to change notification settings - Fork 115
Add Nvidia inference specification #5794
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| { | ||
| "inference.put_nvidia": { | ||
| "documentation": { | ||
| "url": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-nvidia", | ||
| "description": "Create an Nvidia inference endpoint" | ||
| }, | ||
| "stability": "stable", | ||
| "visibility": "public", | ||
| "headers": { | ||
| "accept": ["application/json"], | ||
| "content_type": ["application/json"] | ||
| }, | ||
| "url": { | ||
| "paths": [ | ||
| { | ||
| "path": "/_inference/{task_type}/{nvidia_inference_id}", | ||
| "methods": ["PUT"], | ||
| "parts": { | ||
| "task_type": { | ||
| "type": "enum", | ||
| "description": "The task type", | ||
| "options": [ | ||
| "rerank", | ||
| "text_embedding", | ||
| "completion", | ||
| "chat_completion" | ||
|
Comment on lines
+23
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick, but could these be in alphabetical order? |
||
| ] | ||
| }, | ||
| "nvidia_inference_id": { | ||
| "type": "string", | ||
| "description": "The inference ID" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| "body": { | ||
| "description": "The inference endpoint's task and service settings", | ||
| "required": true | ||
| }, | ||
| "params": { | ||
| "timeout": { | ||
| "type": "time", | ||
| "description": "Specifies the amount of time to wait for the inference endpoint to be created.", | ||
| "default": "30s" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1809,6 +1809,86 @@ export enum MistralServiceType { | |
| mistral | ||
| } | ||
|
|
||
| export class NvidiaServiceSettings { | ||
| /** | ||
| * A valid API key for your Nvidia endpoint. | ||
| * Can be found in `API Keys` section of Nvidia account settings. | ||
| */ | ||
| api_key: string | ||
| /** | ||
| * The URL of the Nvidia model endpoint. | ||
| */ | ||
|
Comment on lines
+1818
to
+1820
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be helpful to include the default URLs for each task type if |
||
| url?: string | ||
| /** | ||
| * The name of the model to use for the inference task. | ||
| * Refer to the model's documentation for the name if needed. | ||
| * Service has been tested and confirmed to be working with the following models: | ||
| * | ||
| * * For `text_embedding` task - `nvidia/llama-3.2-nv-embedqa-1b-v2`. | ||
| * * For `completion` and `chat_completion` tasks - `microsoft/phi-3-mini-128k-instruct`. | ||
| * * For `rerank` task - `nv-rerank-qa-mistral-4b:1`. | ||
| * Service doesn't support `text_embedding` task `baai/bge-m3` and `nvidia/nvclip` models due to them not recognizing the `input_type` parameter. | ||
| */ | ||
| model_id: string | ||
| /** | ||
| * For a `text_embedding` task, the maximum number of tokens per input before chunking occurs. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be "For a `text_embedding` task, the maximum number of tokens per input. Inputs exceeding this value are truncated prior to sending to the Nvidia API." This is wrong almost everywhere in the docs; there's an issue describing some of the problems with |
||
| */ | ||
| max_input_tokens?: integer | ||
| /** | ||
| * For a `text_embedding` task, the similarity measure. One of cosine, dot_product, l2_norm. | ||
| */ | ||
| similarity?: NvidiaSimilarityType | ||
| /** | ||
| * This setting helps to minimize the number of rate limit errors returned from the Nvidia API. | ||
| * By default, the `nvidia` service sets the number of requests allowed per minute to 3000. | ||
| */ | ||
| rate_limit?: RateLimitSetting | ||
| } | ||
|
|
||
| export enum NvidiaTaskType { | ||
| text_embedding, | ||
| completion, | ||
| chat_completion, | ||
| rerank | ||
|
Comment on lines
+1849
to
+1852
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency, could these be in alphabetical order? |
||
| } | ||
|
|
||
| export enum NvidiaServiceType { | ||
| nvidia | ||
| } | ||
|
|
||
| export enum NvidiaSimilarityType { | ||
| cosine, | ||
| dot_product, | ||
| l2_norm | ||
| } | ||
|
|
||
| export class NvidiaTaskSettings { | ||
| /** | ||
| * For a `text_embedding` task, type of input sent to the Nvidia endpoint. | ||
| * Valid values are: | ||
| * | ||
| * * `ingest`: Mapped to Nvidia's `passage` value in request. Used when generating embeddings during indexing. | ||
| * * `search`: Mapped to Nvidia's `query` value in request. Used when generating embeddings during querying. | ||
| * | ||
| * IMPORTANT: If not specified `input_type` field in request to Nvidia endpoint is set as `query` by default. | ||
| */ | ||
| input_type?: NvidiaInputType | ||
| /** | ||
| * For a `text_embedding` task, the method to handle inputs longer than the maximum token length. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To help differentiate this from |
||
| * Valid values are: | ||
| * | ||
| * * `END`: When the input exceeds the maximum input token length, the end of the input is discarded. | ||
| * * `NONE`: When the input exceeds the maximum input token length, an error is returned. | ||
| * * `START`: When the input exceeds the maximum input token length, the start of the input is discarded. | ||
| */ | ||
| truncate?: CohereTruncateType | ||
| } | ||
|
|
||
| export enum NvidiaInputType { | ||
| ingest, | ||
| search | ||
| } | ||
|
|
||
| export class OpenAIServiceSettings { | ||
| /** | ||
| * A valid API key of your OpenAI account. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,6 +140,13 @@ export enum TaskTypeMistral { | |
| completion | ||
| } | ||
|
|
||
| export enum TaskTypeNvidia { | ||
| text_embedding, | ||
| chat_completion, | ||
| completion, | ||
| rerank | ||
|
Comment on lines
+144
to
+147
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency, could these be in alphabetical order? |
||
| } | ||
|
|
||
| export enum TaskTypeOpenAI { | ||
| text_embedding, | ||
| chat_completion, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be getting changed here.