mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Append Model Suffixed to config models
This commit is contained in:
parent
2490e72df5
commit
43e647835b
2 changed files with 30 additions and 30 deletions
|
@ -6,7 +6,7 @@ from pathlib import Path
|
|||
# Internal Packages
|
||||
from src.utils.helpers import get_from_dict
|
||||
|
||||
from src.utils.rawconfig import TextSearchConfig, ImageSearchConfig, ProcessorConversationConfig
|
||||
from src.utils.rawconfig import TextSearchConfigModel, ImageSearchConfigModel, ProcessorConversationConfigModel
|
||||
|
||||
|
||||
class SearchType(str, Enum):
|
||||
|
@ -44,8 +44,8 @@ class SearchModels():
|
|||
image_search: ImageSearchModel = None
|
||||
|
||||
|
||||
class TextSearchConfig():
|
||||
def __init__(self, text_search_config: TextSearchConfig, verbose: bool):
|
||||
class TextSearchConfigModel():
|
||||
def __init__(self, text_search_config: TextSearchConfigModel, verbose: bool):
|
||||
self.input_files = text_search_config.input_files
|
||||
self.input_filter = text_search_config.input_filter
|
||||
self.compressed_jsonl = Path(text_search_config.compressed_jsonl)
|
||||
|
@ -53,8 +53,8 @@ class TextSearchConfig():
|
|||
self.verbose = verbose
|
||||
|
||||
|
||||
class ImageSearchConfig():
|
||||
def __init__(self, image_search_config: ImageSearchConfig, verbose):
|
||||
class ImageSearchConfigModel():
|
||||
def __init__(self, image_search_config: ImageSearchConfigModel, verbose):
|
||||
self.input_directory = Path(image_search_config.input_directory)
|
||||
self.embeddings_file = Path(image_search_config.embeddings_file)
|
||||
self.batch_size = image_search_config.batch_size
|
||||
|
@ -64,14 +64,14 @@ class ImageSearchConfig():
|
|||
|
||||
@dataclass
|
||||
class SearchConfig():
|
||||
notes: TextSearchConfig = None
|
||||
ledger: TextSearchConfig = None
|
||||
music: TextSearchConfig = None
|
||||
image: ImageSearchConfig = None
|
||||
notes: TextSearchConfigModel = None
|
||||
ledger: TextSearchConfigModel = None
|
||||
music: TextSearchConfigModel = None
|
||||
image: ImageSearchConfigModel = None
|
||||
|
||||
|
||||
class ConversationProcessorConfig():
|
||||
def __init__(self, processor_config: ProcessorConversationConfig, verbose: bool):
|
||||
def __init__(self, processor_config: ProcessorConversationConfigModel, verbose: bool):
|
||||
self.openai_api_key = processor_config.open_api_key
|
||||
self.conversation_logfile = Path(processor_config.conversation_logfile)
|
||||
self.chat_log = ''
|
||||
|
|
|
@ -13,50 +13,50 @@ class ConfigBaseModel(BaseModel):
|
|||
alias_generator = to_snake_case_from_dash
|
||||
allow_population_by_field_name = True
|
||||
|
||||
class SearchConfig(ConfigBaseModel):
|
||||
class SearchConfigModel(ConfigBaseModel):
|
||||
input_files: Optional[List[str]]
|
||||
input_filter: Optional[str]
|
||||
embeddings_file: Optional[Path]
|
||||
|
||||
class TextSearchConfig(ConfigBaseModel):
|
||||
class TextSearchConfigModel(ConfigBaseModel):
|
||||
compressed_jsonl: Optional[Path]
|
||||
input_files: Optional[List[str]]
|
||||
input_filter: Optional[str]
|
||||
embeddings_file: Optional[Path]
|
||||
|
||||
class ImageSearchConfig(ConfigBaseModel):
|
||||
class ImageSearchConfigModel(ConfigBaseModel):
|
||||
use_xmp_metadata: Optional[str]
|
||||
batch_size: Optional[int]
|
||||
input_directory: Optional[List[str]]
|
||||
input_filter: Optional[str]
|
||||
embeddings_file: Optional[Path]
|
||||
|
||||
class ContentType(ConfigBaseModel):
|
||||
org: Optional[TextSearchConfig]
|
||||
ledger: Optional[TextSearchConfig]
|
||||
image: Optional[ImageSearchConfig]
|
||||
music: Optional[TextSearchConfig]
|
||||
class ContentTypeModel(ConfigBaseModel):
|
||||
org: Optional[TextSearchConfigModel]
|
||||
ledger: Optional[TextSearchConfigModel]
|
||||
image: Optional[ImageSearchConfigModel]
|
||||
music: Optional[TextSearchConfigModel]
|
||||
|
||||
class AsymmetricConfig(ConfigBaseModel):
|
||||
class AsymmetricConfigModel(ConfigBaseModel):
|
||||
encoder: Optional[str]
|
||||
cross_encoder: Optional[str]
|
||||
|
||||
class ImageSearchTypeConfig(ConfigBaseModel):
|
||||
class ImageSearchTypeConfigModel(ConfigBaseModel):
|
||||
encoder: Optional[str]
|
||||
|
||||
class SearchTypeConfig(ConfigBaseModel):
|
||||
asymmetric: Optional[AsymmetricConfig]
|
||||
image: Optional[ImageSearchTypeConfig]
|
||||
class SearchTypeConfigModel(ConfigBaseModel):
|
||||
asymmetric: Optional[AsymmetricConfigModel]
|
||||
image: Optional[ImageSearchTypeConfigModel]
|
||||
|
||||
class ProcessorConversationConfig(ConfigBaseModel):
|
||||
class ProcessorConversationConfigModel(ConfigBaseModel):
|
||||
open_api_key: Optional[str]
|
||||
conversation_logfile: Optional[str]
|
||||
conversation_history: Optional[str]
|
||||
|
||||
class ProcessorConfig(ConfigBaseModel):
|
||||
conversation: Optional[ProcessorConversationConfig]
|
||||
class ProcessorConfigModel(ConfigBaseModel):
|
||||
conversation: Optional[ProcessorConversationConfigModel]
|
||||
|
||||
class FullConfig(ConfigBaseModel):
|
||||
content_type: Optional[ContentType]
|
||||
search_type: Optional[SearchTypeConfig]
|
||||
processor: Optional[ProcessorConfig]
|
||||
class FullConfigModel(ConfigBaseModel):
|
||||
content_type: Optional[ContentTypeModel]
|
||||
search_type: Optional[SearchTypeConfigModel]
|
||||
processor: Optional[ProcessorConfigModel]
|
||||
|
|
Loading…
Reference in a new issue