pattern singleton per AppConfig.
This commit is contained in:
@@ -33,6 +33,10 @@ api:
|
|||||||
retry_attempts: 3
|
retry_attempts: 3
|
||||||
retry_delay_seconds: 2
|
retry_delay_seconds: 2
|
||||||
currency: EUR
|
currency: EUR
|
||||||
|
# TODO Magari implementare un sistema per settare i providers
|
||||||
|
market_providers: [BinanceWrapper, YFinanceWrapper]
|
||||||
|
news_providers: [GoogleNewsWrapper, DuckDuckGoWrapper]
|
||||||
|
social_providers: [RedditWrapper]
|
||||||
|
|
||||||
agents:
|
agents:
|
||||||
strategy: Conservative
|
strategy: Conservative
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
from typing import Any
|
||||||
import ollama
|
import ollama
|
||||||
import yaml
|
import yaml
|
||||||
import logging.config
|
import logging.config
|
||||||
@@ -104,6 +105,11 @@ class AppConfig(BaseModel):
|
|||||||
log.info(f"Loaded configuration from {file_path}")
|
log.info(f"Loaded configuration from {file_path}")
|
||||||
return configs
|
return configs
|
||||||
|
|
||||||
|
def __new__(cls, *args: Any, **kwargs: Any) -> 'AppConfig':
|
||||||
|
if not hasattr(cls, 'instance'):
|
||||||
|
cls.instance = super(AppConfig, cls).__new__(cls)
|
||||||
|
return cls.instance
|
||||||
|
|
||||||
def get_model_by_name(self, name: str) -> AppModel:
|
def get_model_by_name(self, name: str) -> AppModel:
|
||||||
"""
|
"""
|
||||||
Retrieve a model configuration by its name.
|
Retrieve a model configuration by its name.
|
||||||
|
|||||||
Reference in New Issue
Block a user