Text2vec-huggingface and text2vec-openai API key is invalid after installing weaviate through docker

I installed weaviate through docker and enable text2vec-huggingface. I use additional_headers to input huggingface API key. But when adding documents with huggingface model, I get this error "message’: ‘update vector: failed with status: 400 error: Authorization header is correct, but the token seems invalid’. But when swtiching to Weaivate cloud service, it is working with the same API key. Do you have a clue?

This works:

client = weaviate.Client(
url= WCS_url, # Replace w/ your endpoint
auth_client_secret=weaviate.AuthApiKey(api_key=WCS_API_key), # Replace w/ your Weaviate instance API key. Delete if authentication is disabled.
#url = local_instance_url,
additional_headers={
“X-HuggingFace-Api-Key”: hf_api_key
},

)

This does not work:

client = weaviate.Client(
#url= WCS_url, # Replace w/ your endpoint
#auth_client_secret=weaviate.AuthApiKey(api_key=WCS_API_key), # Replace w/ your Weaviate instance API key. Delete if authentication is disabled.
url = local_instance_url,
additional_headers={
“X-HuggingFace-Api-Key”: hf_api_key
},

)

We eventually solved this issue by adding the API key in the docker image.

How did you add this in docker? I have an issue that the docker image will not pull the huggingface models in docker. Wondering if its related to your fix

Screen Shot 2023-07-24 at 10.18.36 AM

We add the API key here (HUGGINGFAC_APIKEY: sk-foobar). I test it with “microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract” and it is working. Hope this helps!