mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 05:39:12 +00:00
Make conversation processor configurable
This commit is contained in:
@@ -30,3 +30,9 @@ search-type:
|
|||||||
|
|
||||||
image:
|
image:
|
||||||
encoder: "clip-ViT-B-32"
|
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':
|
'image':
|
||||||
{
|
{
|
||||||
'encoder': "clip-ViT-B-32"
|
'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
|
ledger: TextSearchConfig = None
|
||||||
music: TextSearchConfig = None
|
music: TextSearchConfig = None
|
||||||
image: ImageSearchConfig = 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
|
||||||
Reference in New Issue
Block a user