# Feature extraction using Inference API error

**URL:** <https://discuss.huggingface.co/t/feature-extraction-using-inference-api-error/13959>\
**Category:** Beginners\
**Created:** [May 15, 2022, 7:00am UTC](https://discuss.huggingface.co/t/feature-extraction-using-inference-api-error/13959 "2022-05-15T07:00:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![radhavinodsutdlkycic](https://avatars.discourse-cdn.com/v4/letter/r/7feea3/32.png) [@radhavinodsutdlkycic](https://discuss.huggingface.co/u/radhavinodsutdlkycic)\
**Post date:** [May 15, 2022, 7:00am UTC](https://discuss.huggingface.co/t/feature-extraction-using-inference-api-error/13959/1 "2022-05-15T07:00:00Z")

</div>

Hello,  
I was trying to use the inference api to extract features of sentences. However I am getting an error.  
this is my code:  
API\_URL = “[https://api-inference.huggingface.co/models/sentence-transformers/multi-qa-mpnet-base-dot-v1](https://api-inference.huggingface.co/models/sentence-transformers/multi-qa-mpnet-base-dot-v1)”

headers = {“Authorization”: f"Bearer _"}_

 

def query(payload):

```
response = requests.post(API_URL, headers=headers, json=payload)

return response.json()

```

data = query({“inputs”: “writing, painting, or printing signs or show cards used for display or other purposes.”})

print (data)

The error that I get is as follows:  
{‘error’: ['SentenceSimilarityInputsCheck expected dict not list: ` __root__ ` in `parameters`']}

Could you please help me out here?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Buckeyes2019](https://avatars.discourse-cdn.com/v4/letter/b/7c8e57/32.png) [@Buckeyes2019](https://discuss.huggingface.co/u/Buckeyes2019)\
**Post date:** [July 28, 2022, 3:30pm UTC](https://discuss.huggingface.co/t/feature-extraction-using-inference-api-error/13959/2 "2022-07-28T15:30:22Z")

</div>

I had this same issue. It appears in the model hub some of the sentence-transformer API endpoints are set up for sentence similarity while others are set up for feature extraction. Passing the query as you have there to a sentence similarity endpoint results in an error. Try using a different model with a feature extraction endpoint like: `Craig/paraphrase-MiniLM-L6-v2` or `julien-c/distilbert-feature-extraction`

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [May 16, 2023, 12:34am UTC](https://discuss.huggingface.co/t/feature-extraction-using-inference-api-error/13959/3 "2023-05-16T00:34:25Z")

</div>

adding this response here for context

> [@SentenceSimilarityInputsCheck expected dict not list: \`\_\_root\_\_\` in \`parameters\`](https://discuss.huggingface.co/t/sentencesimilarityinputscheck-expected-dict-not-list-root-in-parameters/39715/2):
>
> Hi @Denaldo, Our API Inference supports multiple tasks. For certain models, we provide a straightforward abstraction for embedding similarity, such as with sentences. The tag and/or pipeline\_tag establishes the correct task on the API Inference backend for all compatible models on our hub. When using sentence-similarity, the backend establishes a sentence similarity pipeline. It expects multiple sentence inputs, which will subsequently be transformed into embeddings and compared through cosine…

---

<div class="post-metadata">

**Author:** ![hisachin](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hisachin/32/37584_2.png) [@hisachin](https://discuss.huggingface.co/u/hisachin)\
**Post date:** [December 15, 2024, 11:56am UTC](https://discuss.huggingface.co/t/feature-extraction-using-inference-api-error/13959/4 "2024-12-15T11:56:40Z")

</div>

it worked for me, thanks
