mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-02 10:49:30 +00:00
feat: add additional params to file upload endpoint (#4445)
* adds additional params to file upload endpoint * fix mypy --------- Co-authored-by: Mayank Jobanputra <mayankjobanputra@gmail.com>
This commit is contained in:
parent
7bb6499c29
commit
dda350088b
@ -46,6 +46,7 @@ def upload_file(
|
|||||||
files: List[UploadFile] = File(...),
|
files: List[UploadFile] = File(...),
|
||||||
# JSON serialized string
|
# JSON serialized string
|
||||||
meta: Optional[str] = Form("null"), # type: ignore
|
meta: Optional[str] = Form("null"), # type: ignore
|
||||||
|
additional_params: Optional[str] = Form("null"), # type: ignore
|
||||||
fileconverter_params: FileConverterParams = Depends(FileConverterParams.as_form), # type: ignore
|
fileconverter_params: FileConverterParams = Depends(FileConverterParams.as_form), # type: ignore
|
||||||
preprocessor_params: PreprocessorParams = Depends(PreprocessorParams.as_form), # type: ignore
|
preprocessor_params: PreprocessorParams = Depends(PreprocessorParams.as_form), # type: ignore
|
||||||
):
|
):
|
||||||
@ -75,11 +76,12 @@ def upload_file(
|
|||||||
finally:
|
finally:
|
||||||
file.file.close()
|
file.file.close()
|
||||||
|
|
||||||
|
params = json.loads(additional_params) or {} # type: ignore
|
||||||
|
|
||||||
# Find nodes names
|
# Find nodes names
|
||||||
converters = indexing_pipeline.get_nodes_by_class(BaseConverter)
|
converters = indexing_pipeline.get_nodes_by_class(BaseConverter)
|
||||||
preprocessors = indexing_pipeline.get_nodes_by_class(PreProcessor)
|
preprocessors = indexing_pipeline.get_nodes_by_class(PreProcessor)
|
||||||
|
|
||||||
params = {}
|
|
||||||
for converter in converters:
|
for converter in converters:
|
||||||
params[converter.name] = fileconverter_params.dict()
|
params[converter.name] = fileconverter_params.dict()
|
||||||
for preprocessor in preprocessors:
|
for preprocessor in preprocessors:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user