Description (Actual Behavior)
The documented GET /get_thresholds endpoint returns 500 Internal Server Error when called from Swagger UI.
Swagger documents the required query parameter as prompts, but app.py reads prompt. The route then calls:
recommendation_handler.get_thresholds(prompt, prompt_json, api_url, headers)
while the helper signature is:
get_thresholds(prompts, prompt_json, embedding_fn=None)
This causes the endpoint to fail with a TypeError because the route passes four arguments to a helper that accepts two or three.
Expected Behavior
GET /get_thresholds should accept one or more prompt samples through the documented prompts query parameter and return threshold recommendations as JSON.
For missing or empty prompt samples, the endpoint should return a clear client error instead of a server error.
Possible Fix
Update the route to:
- read the documented
prompts query parameter
- construct an embedding function
- call
recommendation_handler.get_thresholds(prompts, prompt_json, embedding_fn)
- return a JSON
400 response for missing or empty input
- update Swagger to document how multiple
prompts values should be supplied
Steps to Reproduce
- Start the server:
- Open Swagger UI:
http://127.0.0.1:8080/swagger
- Execute
GET /get_thresholds with:
prompts = Act as a data scientist. Help me make this project more inclusive.
- Observe
500 Internal Server Error.
Equivalent curl:
curl -X GET \
'http://127.0.0.1:8080/get_thresholds?prompts=Act%20as%20a%20data%20scientist.%20Help%20me%20make%20this%20project%20more%20inclusive.' \
-H 'accept: */*'
Context
The endpoint is documented in Swagger as “Function that recommends thresholds given an array of prompts,” but it is currently unusable through the documented request shape.
Description (Actual Behavior)
The documented
GET /get_thresholdsendpoint returns500 Internal Server Errorwhen called from Swagger UI.Swagger documents the required query parameter as
prompts, butapp.pyreadsprompt. The route then calls:while the helper signature is:
This causes the endpoint to fail with a
TypeErrorbecause the route passes four arguments to a helper that accepts two or three.Expected Behavior
GET /get_thresholdsshould accept one or more prompt samples through the documentedpromptsquery parameter and return threshold recommendations as JSON.For missing or empty prompt samples, the endpoint should return a clear client error instead of a server error.
Possible Fix
Update the route to:
promptsquery parameterrecommendation_handler.get_thresholds(prompts, prompt_json, embedding_fn)400response for missing or empty inputpromptsvalues should be suppliedSteps to Reproduce
GET /get_thresholdswith:500 Internal Server Error.Equivalent curl:
Context
The endpoint is documented in Swagger as “Function that recommends thresholds given an array of prompts,” but it is currently unusable through the documented request shape.