add support for keys

This commit is contained in:
ishaan-jaff 2023-08-17 15:30:40 -07:00
parent 3f5e47e3ce
commit e72836d181
10 changed files with 13 additions and 141 deletions

View file

@ -22,7 +22,7 @@ class HuggingfaceRestAPILLM():
"content-type": "application/json",
}
# get the api key if it exists in the environment or is passed in, but don't require it
self.api_key = os.getenv("HF_TOKEN") if "HF_TOKEN" in os.environ else api_key
self.api_key = api_key
if self.api_key != None:
self.headers["Authorization"] = f"Bearer {self.api_key}"