Writing and speaking rework, some changes to module upload
This commit is contained in:
@@ -18,11 +18,11 @@ load_dotenv()
|
||||
|
||||
class DependencyInjector:
|
||||
|
||||
def __init__(self, polly_client: any, http_client: HTTPClient, whisper_model: any):
|
||||
def __init__(self, polly_client: any, http_client: HTTPClient, stt: OpenAIWhisper):
|
||||
self._container = containers.DynamicContainer()
|
||||
self._polly_client = polly_client
|
||||
self._http_client = http_client
|
||||
self._whisper_model = whisper_model
|
||||
self._stt = stt
|
||||
|
||||
def inject(self):
|
||||
self._setup_clients()
|
||||
@@ -33,22 +33,25 @@ class DependencyInjector:
|
||||
self._container.wire(
|
||||
packages=["app"]
|
||||
)
|
||||
return self
|
||||
|
||||
def _setup_clients(self):
|
||||
self._container.openai_client = providers.Singleton(AsyncOpenAI)
|
||||
self._container.polly_client = providers.Object(self._polly_client)
|
||||
self._container.http_client = providers.Object(self._http_client)
|
||||
self._container.whisper_model = providers.Object(self._whisper_model)
|
||||
self._container.stt = providers.Object(self._stt)
|
||||
|
||||
def _setup_third_parties(self):
|
||||
self._container.llm = providers.Factory(OpenAI, client=self._container.openai_client)
|
||||
self._container.stt = providers.Factory(OpenAIWhisper, model=self._container.whisper_model)
|
||||
self._container.tts = providers.Factory(AWSPolly, client=self._container.polly_client)
|
||||
|
||||
"""
|
||||
with open('app/services/impl/third_parties/elai/conf.json', 'r') as file:
|
||||
elai_conf = json.load(file)
|
||||
|
||||
with open('app/services/impl/third_parties/elai/avatars.json', 'r') as file:
|
||||
elai_avatars = json.load(file)
|
||||
"""
|
||||
|
||||
with open('app/services/impl/third_parties/heygen/avatars.json', 'r') as file:
|
||||
heygen_avatars = json.load(file)
|
||||
|
||||
Reference in New Issue
Block a user