DocsGPT/application/parser/remote/remote_creator.py

18 lines
594 B
Python
Raw Normal View History

2023-10-12 15:40:23 +00:00
from application.parser.remote.sitemap_loader import SitemapLoader
from application.parser.remote.crawler_loader import CrawlerLoader
2023-10-11 21:03:40 +00:00
from application.parser.remote.web_loader import WebLoader
class RemoteCreator:
loaders = {
'url': WebLoader,
2023-10-12 15:40:23 +00:00
'sitemap': SitemapLoader,
'crawler': CrawlerLoader
2023-10-11 21:03:40 +00:00
}
@classmethod
def create_loader(cls, type, *args, **kwargs):
loader_class = cls.loaders.get(type.lower())
if not loader_class:
raise ValueError(f"No LLM class found for type {type}")
return loader_class(*args, **kwargs)