mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Update to re-use the raw config base models in config.py as well
This commit is contained in:
parent
311c4b7e7b
commit
6292fe4481
1 changed files with 62 additions and 0 deletions
62
src/utils/rawconfig.py
Normal file
62
src/utils/rawconfig.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
# 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
|
||||
|
||||
class SearchConfigTest(ConfigBaseModel):
|
||||
input_files: Optional[List[str]]
|
||||
input_filter: Optional[str]
|
||||
embeddings_file: Optional[Path]
|
||||
|
||||
class TextSearchConfigTest(ConfigBaseModel):
|
||||
compressed_jsonl: Optional[Path]
|
||||
input_files: Optional[List[str]]
|
||||
input_filter: Optional[str]
|
||||
embeddings_file: Optional[Path]
|
||||
|
||||
class ImageSearchConfigTest(ConfigBaseModel):
|
||||
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):
|
||||
org: Optional[TextSearchConfigTest]
|
||||
ledger: Optional[TextSearchConfigTest]
|
||||
image: Optional[ImageSearchConfigTest]
|
||||
music: Optional[TextSearchConfigTest]
|
||||
|
||||
class AsymmetricConfig(ConfigBaseModel):
|
||||
encoder: Optional[str]
|
||||
cross_encoder: Optional[str]
|
||||
|
||||
class ImageSearchTypeConfig(ConfigBaseModel):
|
||||
encoder: Optional[str]
|
||||
|
||||
class SearchTypeConfigTest(ConfigBaseModel):
|
||||
asymmetric: Optional[AsymmetricConfig]
|
||||
image: Optional[ImageSearchTypeConfig]
|
||||
|
||||
class ProcessorConversationConfig(ConfigBaseModel):
|
||||
open_api_key: Optional[str]
|
||||
conversation_logfile: Optional[str]
|
||||
conversation_history: Optional[str]
|
||||
|
||||
class ProcessorConfigTest(ConfigBaseModel):
|
||||
conversation: Optional[ProcessorConversationConfig]
|
||||
|
||||
class FullConfig(ConfigBaseModel):
|
||||
content_type: Optional[ContentType]
|
||||
search_type: Optional[SearchTypeConfigTest]
|
||||
processor: Optional[ProcessorConfigTest]
|
Loading…
Reference in a new issue