diff --git a/sample_config.yml b/sample_config.yml index 2fb447ab..fc04918f 100644 --- a/sample_config.yml +++ b/sample_config.yml @@ -30,3 +30,9 @@ search-type: image: encoder: "clip-ViT-B-32" + +processor: + conversation: + openai-api-key: null + conversation-logfile: "tests/data/.conversation_logs.json" + conversation-history: null \ No newline at end of file diff --git a/src/utils/cli.py b/src/utils/cli.py index b8c725f4..6891463a 100644 --- a/src/utils/cli.py +++ b/src/utils/cli.py @@ -80,6 +80,15 @@ default_config = { 'image': { 'encoder': "clip-ViT-B-32" - } + }, + }, + 'processor': + { + 'conversation': + { + 'openai-api-key': "", + 'conversation-logfile': ".conversation_logs.json", + 'conversation-history': "" + }, } } diff --git a/src/utils/config.py b/src/utils/config.py index 16328e37..7627697a 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -93,3 +93,27 @@ class SearchConfig(): ledger: TextSearchConfig = None music: TextSearchConfig = None image: ImageSearchConfig = None + + +class ConversationProcessorConfig(): + def __init__(self, conversation_logfile, conversation_history, openai_api_key, verbose): + self.openai_api_key = openai_api_key + self.conversation_logfile = conversation_logfile + self.conversation_history = conversation_history + self.verbose = verbose + + def create_from_dictionary(config, key_tree, verbose): + conversation_config = get_from_dict(config, *key_tree) + if not conversation_config: + return None + + return ConversationProcessorConfig( + openai_api_key = conversation_config['openai-api-key'], + conversation_history = '', + conversation_logfile = Path(conversation_config['conversation-logfile']), + verbose = verbose) + + +@dataclass +class ProcessorConfig(): + conversation: ConversationProcessorConfig = None \ No newline at end of file