Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 3.65 KB

feature-extraction.md

File metadata and controls

71 lines (47 loc) · 3.65 KB

Feature Extraction

Feature extraction is the task of converting a text into a vector (often called "embedding").

Example applications:

  • Retrieving the most relevant documents for a query (for RAG applications).
  • Reranking a list of documents based on their similarity to a query.
  • Calculating the similarity between two sentences.

For more details about the feature-extraction task, check out its dedicated page! You will find examples and related materials.

Recommended models

Explore all available models and find the one that suits you best here.

Using the API

<InferenceSnippet pipeline=feature-extraction providersMapping={ {"hf-inference":{"modelId":"intfloat/multilingual-e5-large-instruct","providerModelId":"intfloat/multilingual-e5-large-instruct"},"sambanova":{"modelId":"intfloat/e5-mistral-7b-instruct","providerModelId":"E5-Mistral-7B-Instruct"}} } />

API specification

Request

Headers
authorizationstringAuthentication header in the form 'Bearer: hf_****' when hf_**** is a personal user access token with "Inference Providers" permission. You can generate one from your settings page.
Payload
inputs*unknownOne of the following:
         (#1)string
         (#2)string[]
normalizeboolean
prompt_namestringThe name of the prompt that should be used by for encoding. If not set, no prompt will be applied. Must be a key in the sentence-transformers configuration prompts dictionary. For example if prompt_name is "query" and the prompts is {"query": "query: ", ...}, then the sentence "What is the capital of France?" will be encoded as "query: What is the capital of France?" because the prompt text will be prepended before any text to encode.
truncateboolean
truncation_directionenumPossible values: Left, Right.

Response

| Body | | | :--- | :--- | :--- | | (array) | array[] | Output is an array of arrays. |

close