-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edge Case for json requests #81
Comments
The goal is to try to group your requests to cover different scenarios. Here's a few I can think of:
I encourage you to be creative and expand this list! If you are having trouble finding edge cases, you could move on to writing unit tests. |
Two questions based on trying a few examples:
(should update README) |
By the way, all the situations you suggested I check out, work. Except for when the |
Great! Yeah ideally we would catch this and return a more informative status code (maybe a 400 or 422) with a message (the "uid" provided does not appear to be a valid PMID) |
I'm not clear on how to interpret the output based on the input:
|
I see. The other 17 things come from the index. During every request, we check if the query or documents are in the index. If not, we add them. They will be included in the search during subsequent requests. I can think about where to explain this, probably in the readme somewhere. |
I see. So when you provide a POST body with |
Yes
I see. Yeah, this is why I was trying to be such a stickler about the API/Schemas/Use cases during all the meetings. I think it would be easy enough to support the original idea. Probably just a single param like |
No don't change anything code-wise, I was just trying to clarify the expected behaviour as it exists. The only ambiguity is what's in the index at the time that a client hits it. |
Hey @JohnGiorgi, had a question regarding displaying the message. I pinpointed the location to fix the problem where uid is not valid to this place in the semantic-search/semantic_search/ncbi.py Lines 101 to 103 in a52492f
Essentially this only triggers for us when the PMID is not valid so when the if statement were to trigger, we would stop our iteration and display a message. I was confused as to how you actually display the message for the user. I think technically that should work. |
Check out the FastAPI documentation on handling errors: https://fastapi.tiangolo.com/tutorial/handling-errors/?h=erro. It should just be a matter of adding something like: raise HTTPException(status_code=422, detail='the "uid" provided does not appear to be a valid PMID') @jvwong, @maxkfranz, not sure which @Anwesh1 Is there a way to pinpoint which |
Line 102 where it states |
Cool. Can we access this as a string and pass it to the So something like: if "PMID" not in record:
raise HTTPException(status_code=422, detail=f"No PMID for {json.dumps(record)}") The only concern is that |
Essentially, that |
Hey @JohnGiorgi, I've been bombarding semantic search with a lot of weird scenarios of inputs. I also sent a request for 30+ documents and it seems to work fine (which is great!!). I'm going to continue pushing weird requests to it but is there any specific thing that I should try instead that you think could break the code?
Let me know, thanks.
The text was updated successfully, but these errors were encountered: