2021-11-28 17:57:13 +01:00
|
|
|
# System Packages
|
|
|
|
from pathlib import Path
|
|
|
|
from typing import List, Optional
|
|
|
|
|
|
|
|
# External Packages
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
# Internal Packages
|
|
|
|
from src.utils.helpers import to_snake_case_from_dash
|
|
|
|
|
|
|
|
class ConfigBaseModel(BaseModel):
|
|
|
|
class Config:
|
|
|
|
alias_generator = to_snake_case_from_dash
|
|
|
|
allow_population_by_field_name = True
|
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class SearchConfigModel(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
input_files: Optional[List[str]]
|
|
|
|
input_filter: Optional[str]
|
|
|
|
embeddings_file: Optional[Path]
|
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class TextSearchConfigModel(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
compressed_jsonl: Optional[Path]
|
|
|
|
input_files: Optional[List[str]]
|
|
|
|
input_filter: Optional[str]
|
|
|
|
embeddings_file: Optional[Path]
|
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class ImageSearchConfigModel(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
use_xmp_metadata: Optional[str]
|
|
|
|
batch_size: Optional[int]
|
2021-12-05 15:31:39 +01:00
|
|
|
input_directory: Optional[Path]
|
2021-11-28 17:57:13 +01:00
|
|
|
input_filter: Optional[str]
|
|
|
|
embeddings_file: Optional[Path]
|
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class ContentTypeModel(ConfigBaseModel):
|
|
|
|
org: Optional[TextSearchConfigModel]
|
|
|
|
ledger: Optional[TextSearchConfigModel]
|
|
|
|
image: Optional[ImageSearchConfigModel]
|
|
|
|
music: Optional[TextSearchConfigModel]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class AsymmetricConfigModel(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
encoder: Optional[str]
|
|
|
|
cross_encoder: Optional[str]
|
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class ImageSearchTypeConfigModel(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
encoder: Optional[str]
|
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class SearchTypeConfigModel(ConfigBaseModel):
|
|
|
|
asymmetric: Optional[AsymmetricConfigModel]
|
|
|
|
image: Optional[ImageSearchTypeConfigModel]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class ProcessorConversationConfigModel(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
open_api_key: Optional[str]
|
|
|
|
conversation_logfile: Optional[str]
|
|
|
|
conversation_history: Optional[str]
|
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class ProcessorConfigModel(ConfigBaseModel):
|
|
|
|
conversation: Optional[ProcessorConversationConfigModel]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2021-12-04 16:51:21 +01:00
|
|
|
class FullConfigModel(ConfigBaseModel):
|
|
|
|
content_type: Optional[ContentTypeModel]
|
|
|
|
search_type: Optional[SearchTypeConfigModel]
|
|
|
|
processor: Optional[ProcessorConfigModel]
|