Sorry, I am quite new to this -> I am calling load_index_from_storage(), then on the index as_query_engine() and then I use .query() on the query engine. Is that not right?
It is fine, if you want to return the whole object, I would suggest you extract the required content from the response object , maje a dict and return that.
Flask has this issue with json serialization of pydantic object