Conversation
|
Can one of the admins verify this patch? |
hospexplorer/ask/views.py
Outdated
|
|
||
| answer_text = "" | ||
| if "choices" in llm_response and llm_response["choices"]: | ||
| answer_text = llm_response["choices"][0].get("message", {}).get("content", "") |
There was a problem hiding this comment.
I think there is the try/except block from the development branch missing here
hospexplorer/ask/views.py
Outdated
| elif "message" in llm_response: # Fallback for mock response format | ||
| answer_text = llm_response["message"] | ||
|
|
||
| QARecord.objects.create( |
There was a problem hiding this comment.
I think you want to create the record before sending it to the LLM since there can be a significant lack between sending and answering. and then update it with the answer once you have it. This will change a little anyways when polling I presume.
There was a problem hiding this comment.
And one thing I'm just thinking of, we probably want to be able to indicate any error responses (e.g. when the request is timed out). So the model will need to accommodate that.
…and recording answer based on llm behavior
hospexplorer/ask/views.py
Outdated
| answer_text = "" | ||
| if "choices" in llm_response and llm_response["choices"]: | ||
| answer_text = llm_response["choices"][0].get("message", {}).get("content", "") | ||
| elif "message" in llm_response: |
There was a problem hiding this comment.
I think there was a comment here in some version of the file explaining this was for the mock server? This should be here as well. or even better, the mock server should return the same format as the real one.
…nse is now the same" This reverts commit 215f66a.
| error_msg = f"Unexpected response from server: {e}" | ||
| except Exception as e: | ||
| return JsonResponse({"error": f"Failed to connect to server: {e}"}, status=500) No newline at end of file | ||
| error_msg = f"Failed to connect to server: {e}" |
There was a problem hiding this comment.
the exceptions need to be logged
Guidelines for Pull Requests
If you haven't yet read our code review guidelines, please do so, You can find them here.
Please confirm the following by adding an x for each item (turn
[ ]into[x]).Please provide a brief description of your ticket
Store questions and answers for each user
Description
Properties:
Question
question
timestamp
user asking the question
answer
Answer
all the details send from the AI
timestamp
corresponding question
user that asked the question
HOP-8
Are there any other pull requests that this one depends on?
story/HOP-7
Anything else the reviewer needs to know?
... describe here ...