huggingface_provider.py 692 B

12345678910111213141516171819202122
  1. from typing import Optional
  2. from core.llm.provider.base import BaseProvider
  3. from models.provider import ProviderName
  4. class HuggingfaceProvider(BaseProvider):
  5. def get_models(self, model_id: Optional[str] = None) -> list[dict]:
  6. credentials = self.get_credentials(model_id)
  7. # todo
  8. return []
  9. def get_credentials(self, model_id: Optional[str] = None) -> dict:
  10. """
  11. Returns the API credentials for Huggingface as a dictionary, for the given tenant_id.
  12. """
  13. return {
  14. 'huggingface_api_key': self.get_provider_api_key(model_id=model_id)
  15. }
  16. def get_provider_name(self):
  17. return ProviderName.HUGGINGFACEHUB