-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import sys | ||
|
||
from ragbits.core.utils import get_cls_from_config | ||
|
||
from .base import BaseProvider | ||
from .dummy import DummyProvider | ||
from .unstructured import UnstructuredProvider | ||
|
||
__all__ = ["BaseProvider", "DummyProvider", "UnstructuredProvider"] | ||
|
||
module = sys.modules[__name__] | ||
|
||
|
||
def get_provider(provider_config: dict) -> BaseProvider: | ||
""" | ||
Initializes and returns an Provider object based on the provided configuration. | ||
Args: | ||
provider_config : A dictionary containing configuration details for the provider. | ||
Returns: | ||
An instance of the specified Provider class, initialized with the provided config | ||
(if any) or default arguments. | ||
""" | ||
|
||
provider_cls = get_cls_from_config(provider_config["type"], module) | ||
config = provider_config.get("config", {}) | ||
|
||
return provider_cls(**config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters