DocsGPT/application/parser/remote/remote_creator.py

21 lines
715 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
2024-03-16 14:52:05 +00:00
from application.parser.remote.reddit_loader import RedditPostsLoaderRemote
2023-10-11 21:03:40 +00:00
class RemoteCreator:
loaders = {
2024-03-16 14:52:05 +00:00
"url": WebLoader,
"sitemap": SitemapLoader,
"crawler": CrawlerLoader,
"reddit": RedditPostsLoaderRemote,
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}")
2024-03-16 14:52:05 +00:00
return loader_class(*args, **kwargs)