-
Notifications
You must be signed in to change notification settings - Fork 101
Update inference specification for Hugging Face's rerank task #4417
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
6ee71a8
b7a3129
9663bf8
4e1cfba
6a71574
e73e977
3eb5a12
8d821cb
e5d927c
b46067e
9b6f3ba
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.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,9 +86,11 @@ export enum TaskTypeGoogleVertexAI { | |
} | ||
|
||
export enum TaskTypeHuggingFace { | ||
text_embedding, | ||
chat_completion, | ||
completion | ||
completion, | ||
rerank, | ||
sparse_embedding, | ||
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. @jonathan-buttner Please confirm if we want to include sparse_embedding into a list of supported HF tasks. Because HF models don't provide sparse embeddings support out of the box. |
||
text_embedding | ||
} | ||
|
||
export enum TaskTypeMistral { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ import { TaskType } from '@inference/_types/TaskType' | |
* * ELSER (`sparse_embedding`) | ||
* * Google AI Studio (`completion`, `text_embedding`) | ||
* * Google Vertex AI (`rerank`, `text_embedding`) | ||
* * Hugging Face (`text_embedding`) | ||
* * Hugging Face (`chat_completion`, `completion`, `rerank`, `sparse_embedding`, `text_embedding`) | ||
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. @jonathan-buttner could you please confirm that we want to add sparse_embedding task here? 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. @davidkyle do we want to document hugging face support for sparse embedding aka elser? I don't think we ever released elser on hugging face for customers right? |
||
* * Mistral (`text_embedding`) | ||
* * OpenAI (`chat_completion`, `completion`, `text_embedding`) | ||
* * VoyageAI (`text_embedding`, `rerank`) | ||
|
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. Let's add the 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. Thank you, Jonathan. Done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
summary: A rerank task | ||
description: Run `PUT _inference/rerank/hugging-face-rerank` to create an inference endpoint that performs a `rerank` task type. | ||
# method_request: "PUT _inference/rerank/hugging-face-rerank" | ||
# type: "request" | ||
value: |- | ||
{ | ||
"service": "hugging_face", | ||
"service_settings": { | ||
"api_key": "hugging-face-access-token", | ||
"url": "url-endpoint" | ||
}, | ||
"task_settings": { | ||
"return_documents": true, | ||
"top_n": 3 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
summary: Rerank task | ||
description: Run `POST _inference/rerank/bge-reranker-base-mkn` to perform reranking on the example input via Hugging Face | ||
# method_request: "POST _inference/rerank/bge-reranker-base-mkn" | ||
# type: "request" | ||
value: |- | ||
{ | ||
"input": ["luke", "like", "leia", "chewy","r2d2", "star", "wars"], | ||
"query": "star wars main character", | ||
"return_documents": false, | ||
"top_n": 2 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
summary: Rerank task | ||
description: Run `POST _inference/rerank/bge-reranker-base-mkn` to perform reranking on the example input via Hugging Face | ||
# method_request: "POST _inference/rerank/bge-reranker-base-mkn" | ||
# type: "request" | ||
value: |- | ||
{ | ||
"input": ["luke", "like", "leia", "chewy","r2d2", "star", "wars"], | ||
"query": "star wars main character", | ||
"return_documents": true, | ||
"top_n": 3 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
summary: Rerank task | ||
description: > | ||
A successful response from `POST _inference/rerank/bge-reranker-base-mkn`. | ||
# type: "response" | ||
# response_code: | ||
value: |- | ||
{ | ||
"rerank": [ | ||
{ | ||
"index": 6, | ||
"relevance_score": 0.50955844 | ||
}, | ||
{ | ||
"index": 5, | ||
"relevance_score": 0.084341794 | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
summary: Rerank task | ||
description: > | ||
A successful response from `POST _inference/rerank/bge-reranker-base-mkn`. | ||
# type: "response" | ||
# response_code: | ||
value: |- | ||
{ | ||
"rerank": [ | ||
{ | ||
"index": 6, | ||
"relevance_score": 0.50955844, | ||
"text": "wars" | ||
}, | ||
{ | ||
"index": 5, | ||
"relevance_score": 0.084341794, | ||
"text": "star" | ||
}, | ||
{ | ||
"index": 3, | ||
"relevance_score": 0.004520818, | ||
"text": "chewy" | ||
} | ||
] | ||
} |
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.
@jonathan-buttner same thing here