mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Change parse_obj calls to use model_validate per new pydantic specification
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user