I have a strange bug that fails consistently.
I am using FastAPI to develop my plugin and making extensive use of Enums to hopefully “guide” ChatGPT as much as possible. (The system works great for the most part)
Here is my plugin working, note how it calls my localhost API and passes in Stage III:
If I change that field from a
str to an
Enum like this:
stage: str = Query( None, description=desc.FILTER_PRE + desc.THERAPY_DISEASE_STAGE, ),
stage: schemas.enums.DiseaseStage = Query( None, description=desc.FILTER_PRE + desc.THERAPY_DISEASE_STAGE, ),
Where Disease Stage is:
class DiseaseStage(str, BaseEnum): STAGE_0 = "Stage 0" STAGE_I = "Stage I" STAGE_II = "Stage II" STAGE_III = "Stage III" STAGE_IV = "Stage IV"
Note that Enums as lists in parameters work fine regardless:
responses: List[schemas.enums.Response] = Query( None, description=desc.FILTER_PRE + desc.THERAPY_RESPONSE ),
When the Enum param is in place, there is no traffic to my API. I validated this by watching the network traffic:
I have tried multiple times, switching back and forth between str and the Enum, uninstalling/re-installing, switching localhost ports to make sure it isn’t caching and I get a very consistent error.
Explanation of what my plugin does here if that helps:
Thanks for any help…