Skip to content

Commit

Permalink
fix leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
masci committed Feb 14, 2024
1 parent 81cb0e3 commit fedf467
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/hayhooks/server/pipelines/models.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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 = {}
Expand All @@ -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"]
Expand Down
6 changes: 1 addition & 5 deletions src/hayhooks/server/utils/deploy_utils.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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())

Expand Down

0 comments on commit fedf467

Please sign in to comment.