2024-06-15 02:46:02 +08:00
|
|
|
from services.auth.firecrawl import FirecrawlAuth
|
2024-09-30 09:57:19 +08:00
|
|
|
from services.auth.jina import JinaAuth
|
2024-06-15 02:46:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ApiKeyAuthFactory:
|
|
|
|
def __init__(self, provider: str, credentials: dict):
|
2024-08-26 13:43:57 +08:00
|
|
|
if provider == "firecrawl":
|
2024-06-15 02:46:02 +08:00
|
|
|
self.auth = FirecrawlAuth(credentials)
|
2024-09-30 09:57:19 +08:00
|
|
|
elif provider == "jinareader":
|
|
|
|
self.auth = JinaAuth(credentials)
|
2024-06-15 02:46:02 +08:00
|
|
|
else:
|
2024-08-26 13:43:57 +08:00
|
|
|
raise ValueError("Invalid provider")
|
2024-06-15 02:46:02 +08:00
|
|
|
|
|
|
|
def validate_credentials(self):
|
|
|
|
return self.auth.validate_credentials()
|