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
|
|
|
|
|
2022-01-15 02:54:38 +01:00
|
|
|
class TextContentConfig(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]
|
|
|
|
|
2022-01-15 02:54:38 +01:00
|
|
|
class ImageContentConfig(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]
|
|
|
|
|
2022-01-15 02:54:38 +01:00
|
|
|
class ContentConfig(ConfigBase):
|
|
|
|
org: Optional[TextContentConfig]
|
|
|
|
ledger: Optional[TextContentConfig]
|
|
|
|
image: Optional[ImageContentConfig]
|
|
|
|
music: Optional[TextContentConfig]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2022-01-15 02:54:38 +01:00
|
|
|
class SymmetricSearchConfig(ConfigBase):
|
2022-01-14 22:46:56 +01:00
|
|
|
encoder: Optional[str]
|
|
|
|
cross_encoder: Optional[str]
|
|
|
|
model_directory: Optional[Path]
|
|
|
|
|
2022-01-15 02:54:38 +01:00
|
|
|
class AsymmetricSearchConfig(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
|
|
|
|
2022-01-15 02:54:38 +01:00
|
|
|
class ImageSearchConfig(ConfigBase):
|
2021-11-28 17:57:13 +01:00
|
|
|
encoder: Optional[str]
|
2022-01-14 23:09:18 +01:00
|
|
|
model_directory: Optional[Path]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2022-01-15 02:54:38 +01:00
|
|
|
class SearchConfig(ConfigBase):
|
|
|
|
asymmetric: Optional[AsymmetricSearchConfig]
|
|
|
|
symmetric: Optional[SymmetricSearchConfig]
|
|
|
|
image: Optional[ImageSearchConfig]
|
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]
|
|
|
|
|
2022-01-15 02:54:38 +01:00
|
|
|
class ProcessorConfig(ConfigBase):
|
2021-12-09 14:50:38 +01:00
|
|
|
conversation: Optional[ConversationProcessorConfig]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
2021-12-09 14:50:38 +01:00
|
|
|
class FullConfig(ConfigBase):
|
2022-01-15 02:54:38 +01:00
|
|
|
content_type: Optional[ContentConfig]
|
|
|
|
search_type: Optional[SearchConfig]
|
|
|
|
processor: Optional[ProcessorConfig]
|