deepset-ai / hayhooks

Deploy Haystack pipelines behind a REST Api.
https://haystack.deepset.ai
Apache License 2.0
30 stars 8 forks source link

Fixed JSON Schema Serialization for Components #7

Closed tellmewyatt closed 1 month ago

tellmewyatt commented 3 months ago

Currently if you try to go to http://localhost:1416/docs#/ with an extractive pipeline, an error will be thrown because the response class, ExtractedAnswer, contains a DataFrame, which pydantic is unable to serialize. I have added a function create_valid_type that creates a new type, replacing invalid types with those specified. This also means that it is no longer necessary to convert Documents to HaystackDocument for validation by pydantic.