Closed arun13go closed 4 months ago
Hey Team, Is there update as customer is waiting for a fix. Can you please prioritise this bug if possible.
I'm still working to figure out why this is happening. But this is being caused because the call to open ai here:
Is returning a stop finish reason. That causes the code to enter the else block, which does not populate the source_documents
data:
However, in the returned message, it still includes a reference to a document e.g. .... [doc1]
. We then look up source document 1 from the empty list and a IndexError is thrown.
I think this is caused by the previous citation references e.g. .... [doc1]
being included in the previous messages we send to the chatgpt model here:
The journey through the code it's taking, does not interact with AzureAI Search or our blob storage, therefore the only information it has reference to is in the model itself and previous messages. I think it is then "accidentally" including previous references in it's response.
I believe I have proven this theory by re-running an example that exercised this bug, with and without past messages included in the chat completion. Without the past messages, this error does not occur.
To fix this I think there are a few options:
[docN]
references if there are no source documents[docN]
references from past messagesI've tried various different system messages but have been unable to force the chat to always call the function.
That leaves solutions 1 or 2, which are very similar.
@ruoccofabrizio - do you have a view whether Option 1 or 2?
I have raised a change to fix the issue described above https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator/pull/193
In my testing I have also noticed that it is also possible to get a IndexError in a different location:
ERROR:root:Exception in /api/conversation/custom | list index out of range
Traceback (most recent call last):
File "/workspaces/chat-with-your-data-solution-accelerator/code/app/app.py", line 283, in conversation_custom
chat_history.append((user_assistant_messages[i]['content'],user_assistant_messages[i+1]['content']))
This happens after there has been another error, and no response has been returned from the assistant. Our code however expects there to always be an assistant message after a user message, i.e. 1 message back and forth.
This will also need fixing.
Both issues should now be fixed.
This issue is for a: (mark with an
x
)Minimal steps to reproduce
Any log messages given by the failure
Expected/desired behavior
OS and Version?
Versions
Mention any other details that might be useful
redacted_error_userquery.log