-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
19f3263
commit 13f2973
Showing
26 changed files
with
180 additions
and
155 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
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 |
---|---|---|
@@ -1,29 +1,30 @@ | ||
from redis import Redis as CacheManager | ||
from redis.connection import ConnectionPool | ||
|
||
from app.schemas.config import Config | ||
|
||
from app.schemas.config import Settings | ||
|
||
from ._modelclients import ModelClients | ||
from ._authenticationclient import AuthenticationClient | ||
from ._vectorstore import VectorStore | ||
|
||
|
||
class ClientsManager: | ||
def __init__(self, config: Config): | ||
self.config = config | ||
def __init__(self, settings: Settings) -> None: | ||
self.settings = settings | ||
|
||
def set(self): | ||
# set models | ||
self.models = ModelClients(config=self.config) | ||
self.models = ModelClients(settings=self.settings) | ||
|
||
# set cache | ||
self.cache = CacheManager(connection_pool=ConnectionPool(**self.config.databases.cache.args)) | ||
self.cache = CacheManager(connection_pool=ConnectionPool(**self.settings.config.databases.cache.args)) | ||
|
||
# set vectors | ||
self.vectors = VectorStore(models=self.models, **self.config.databases.vectors.args) | ||
self.vectors = VectorStore(models=self.models, **self.settings.config.databases.vectors.args) | ||
|
||
# set auth | ||
self.auth = AuthenticationClient(cache=self.cache, **self.config.auth.args) if self.config.auth else None | ||
self.auth = AuthenticationClient(cache=self.cache, **self.settings.config.auth.args) if self.settings.config.auth else None | ||
|
||
def clear(self): | ||
self.vectors.close() |
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
Oops, something went wrong.