From fedf4674887b243d2ad14aec40857aeebc6d4dba Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Wed, 14 Feb 2024 15:48:08 +0100 Subject: [PATCH] fix leftovers --- src/hayhooks/server/pipelines/models.py | 8 ++++++-- src/hayhooks/server/utils/deploy_utils.py | 6 +----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hayhooks/server/pipelines/models.py b/src/hayhooks/server/pipelines/models.py index 8f3d877..816d363 100644 --- a/src/hayhooks/server/pipelines/models.py +++ b/src/hayhooks/server/pipelines/models.py @@ -1,6 +1,6 @@ from typing import get_args, get_origin, List -from pydantic import BaseModel, create_model +from pydantic import BaseModel, create_model, ConfigDict from haystack.dataclasses import Document @@ -26,6 +26,8 @@ def get_request_model(pipeline_name: str, pipeline_inputs): } """ request_model = {} + config = ConfigDict(arbitrary_types_allowed=True) + for component_name, inputs in pipeline_inputs.items(): component_model = {} @@ -46,7 +48,9 @@ def get_response_model(pipeline_name: str, pipeline_outputs): } """ response_model = {} - for component_name, outputs in pipe.outputs().items(): + config = ConfigDict(arbitrary_types_allowed=True) + + for component_name, outputs in pipeline_outputs.items(): component_model = {} for name, typedef in outputs.items(): output_type = typedef["type"] diff --git a/src/hayhooks/server/utils/deploy_utils.py b/src/hayhooks/server/utils/deploy_utils.py index 2e85f2b..eada5e6 100644 --- a/src/hayhooks/server/utils/deploy_utils.py +++ b/src/hayhooks/server/utils/deploy_utils.py @@ -1,16 +1,14 @@ from fastapi import HTTPException from fastapi.responses import JSONResponse -from pydantic import ConfigDict + from hayhooks.server.pipelines import registry from hayhooks.server.pipelines.models import ( - HaystackDocument, PipelineDefinition, get_request_model, get_response_model, convert_component_output, ) -from haystack.dataclasses import Document def deploy_pipeline_def(app, pipeline_def: PipelineDefinition): @@ -19,8 +17,6 @@ def deploy_pipeline_def(app, pipeline_def: PipelineDefinition): except ValueError as e: raise HTTPException(status_code=409, detail=f"{e}") from e - config = ConfigDict(arbitrary_types_allowed=True) - PipelineRunRequest = get_request_model(pipeline_def.name, pipe.inputs()) PipelineRunResponse = get_response_model(pipeline_def.name, pipe.outputs())