diff --git a/src/khoj/routers/api.py b/src/khoj/routers/api.py index b384d8a3..dd2a2837 100644 --- a/src/khoj/routers/api.py +++ b/src/khoj/routers/api.py @@ -122,7 +122,7 @@ async def map_config_to_db(config: FullConfig, user: KhojUser): def _initialize_config(): if state.config is None: state.config = FullConfig() - state.config.search_type = SearchConfig.parse_obj(constants.default_config["search-type"]) + state.config.search_type = SearchConfig.model_validate(constants.default_config["search-type"]) @api.get("/config/data", response_model=FullConfig) diff --git a/src/khoj/search_type/text_search.py b/src/khoj/search_type/text_search.py index f07eb580..7e295903 100644 --- a/src/khoj/search_type/text_search.py +++ b/src/khoj/search_type/text_search.py @@ -163,7 +163,7 @@ def deduplicated_search_responses(hits: List[SearchResponse]): else: hit_ids.add(hit.corpus_id) - yield SearchResponse.parse_obj( + yield SearchResponse.model_validate( { "entry": hit.entry, "score": hit.score, diff --git a/src/khoj/utils/yaml.py b/src/khoj/utils/yaml.py index abfe270a..36546688 100644 --- a/src/khoj/utils/yaml.py +++ b/src/khoj/utils/yaml.py @@ -39,7 +39,7 @@ def load_config_from_file(yaml_config_file: Path) -> dict: def parse_config_from_string(yaml_config: dict) -> FullConfig: "Parse and validate config in YML string" - return FullConfig.parse_obj(yaml_config) + return FullConfig.model_validate(yaml_config) def parse_config_from_file(yaml_config_file):