mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Make conversation processor configurable
This commit is contained in:
parent
d4e1120b22
commit
a99b4b3434
3 changed files with 40 additions and 1 deletions
|
@ -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
|
|
@ -80,6 +80,15 @@ default_config = {
|
|||
'image':
|
||||
{
|
||||
'encoder': "clip-ViT-B-32"
|
||||
}
|
||||
},
|
||||
},
|
||||
'processor':
|
||||
{
|
||||
'conversation':
|
||||
{
|
||||
'openai-api-key': "",
|
||||
'conversation-logfile': ".conversation_logs.json",
|
||||
'conversation-history': ""
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue