Closed poeeain closed 7 months ago
I think the problem might be due to the environment variables AZURE_OPENAI_API_KEY= OPENAI_API_KEY=
Maybe, however, I only use HuggingFace model, is it necessary to add other API keys?
It's not necessary just use huggingface token
Actually, there are two things here. The embedding model and the LLM. OpenAI provides both embedding models (Ada, small and large) and LLMs (GPT3.5, 4, etc).
By default the library uses OpenAI 3small for embedding and OpenAI 3.5 GPT for the LLM. For both these, it uses the same OPENAI keys (either directly OPENAI_API_KEY or the Azure keys if you are running them from Azure).
The library right now supports HuggingFace inference models (for LLM). It does not support open soruce HuggingFace embedding models. The only embedding models supported at this time are OpenAI's Ada, 3small, 3large and Cohere's embedding model.
So, as it stands today, you will need to either provide an OPENAI (/ Azure OpenAI) key OR cohere embedding key (make sure to set CohereEmbedding as the emedding model in the loader). This is regardless of the LLM you use, which can be a free HuggingFace model.
Hope this answers your question.
PS: Adding support for HuggingFace embedding models is in the plan but later down the line. Right now, I am adding support for Azure Vector databases. If you want to, you can send in a PR to add support for HuggingFace emebdding models, I will review them and we can get the feature added sooner.
I will go ahead and close this issue for now if there are no more open questions.
I try to use Huggingface model like the following, but it shows error. Probably, I set the wrong config, please help me check it. Thanks in advance.
.env file
Code :
Error :