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:44:13 +01:00
|
|
|
class SearchConfig(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:44:13 +01:00
|
|
|
class TextSearchConfig(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:44:13 +01:00
|
|
|
class ImageSearchConfig(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
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):
|
2021-12-04 16:44:13 +01:00
|
|
|
org: Optional[TextSearchConfig]
|
|
|
|
ledger: Optional[TextSearchConfig]
|
|
|
|
image: Optional[ImageSearchConfig]
|
|
|
|
music: Optional[TextSearchConfig]
|
2021-11-28 17:57:13 +01:00
|
|
|
|
|
|
|
class AsymmetricConfig(ConfigBaseModel):
|
|
|
|
encoder: Optional[str]
|
|
|
|
cross_encoder: Optional[str]
|
|
|
|
|
|
|
|
class ImageSearchTypeConfig(ConfigBaseModel):
|
|
|
|
encoder: Optional[str]
|
|
|
|
|
2021-12-04 16:44:13 +01:00
|
|
|
class SearchTypeConfig(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
asymmetric: Optional[AsymmetricConfig]
|
|
|
|
image: Optional[ImageSearchTypeConfig]
|
|
|
|
|
|
|
|
class ProcessorConversationConfig(ConfigBaseModel):
|
|
|
|
open_api_key: Optional[str]
|
|
|
|
conversation_logfile: Optional[str]
|
|
|
|
conversation_history: Optional[str]
|
|
|
|
|
2021-12-04 16:44:13 +01:00
|
|
|
class ProcessorConfig(ConfigBaseModel):
|
2021-11-28 17:57:13 +01:00
|
|
|
conversation: Optional[ProcessorConversationConfig]
|
|
|
|
|
|
|
|
class FullConfig(ConfigBaseModel):
|
|
|
|
content_type: Optional[ContentType]
|
2021-12-04 16:44:13 +01:00
|
|
|
search_type: Optional[SearchTypeConfig]
|
|
|
|
processor: Optional[ProcessorConfig]
|