Feature extraction using Inference API error

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

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

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