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
|
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class ConfigBase(BaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
class Config:
|
|
|
|
alias_generator = to_snake_case_from_dash
|
|
|
|
allow_population_by_field_name = True
|
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class SearchConfig(ConfigBase):
|
2021-11-28 17:57:13 +01:00
|
|
|
input_files: Optional[List[str]]
|
|
|
|
input_filter: Optional[str]
|
|
|
|
embeddings_file: Optional[Path]
|
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class TextSearchConfig(ConfigBase):
|
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-09 14:50:38 +01:00
|
|
|
class ImageSearchConfig(ConfigBase):
|
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-09 14:50:38 +01:00
|
|
|
class ContentTypeConfig(ConfigBase):
|
|
|
|
org: Optional[TextSearchConfig]
|
|
|
|
ledger: Optional[TextSearchConfig]
|
|
|
|
image: Optional[ImageSearchConfig]
|
|
|
|
music: Optional[TextSearchConfig]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class AsymmetricConfig(ConfigBase):
|
2021-11-28 17:57:13 +01:00
|
|
|
encoder: Optional[str]
|
|
|
|
cross_encoder: Optional[str]
|
2022-01-14 22:31:55 +01:00
|
|
|
model_directory: Optional[Path]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class ImageSearchTypeConfig(ConfigBase):
|
2021-11-28 17:57:13 +01:00
|
|
|
encoder: Optional[str]
|
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class SearchTypeConfig(ConfigBase):
|
|
|
|
asymmetric: Optional[AsymmetricConfig]
|
|
|
|
image: Optional[ImageSearchTypeConfig]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class ConversationProcessorConfig(ConfigBase):
|
2021-12-20 08:56:35 +01:00
|
|
|
openai_api_key: Optional[str]
|
2021-11-28 17:57:13 +01:00
|
|
|
conversation_logfile: Optional[str]
|
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class ProcessorConfigModel(ConfigBase):
|
|
|
|
conversation: Optional[ConversationProcessorConfig]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class FullConfig(ConfigBase):
|
|
|
|
content_type: Optional[ContentTypeConfig]
|
|
|
|
search_type: Optional[SearchTypeConfig]
|
2021-12-04 16:51:21 +01:00
|
|
|
processor: Optional[ProcessorConfigModel]
|