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):
|
2022-01-25 03:53:26 +01:00
|
|
|
use_xmp_metadata: Optional[bool]
|
2021-11-28 17:57:13 +01:00
|
|
|
batch_size: Optional[int]
|
2022-07-20 00:54:03 +02:00
|
|
|
input_directories: Optional[List[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-07-21 16:05:43 +02:00
|
|
|
class TextSearchConfig(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):
|
2022-07-21 16:05:43 +02:00
|
|
|
asymmetric: Optional[TextSearchConfig]
|
|
|
|
symmetric: Optional[TextSearchConfig]
|
2022-01-15 02:54:38 +01:00
|
|
|
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]
|