llmware icon indicating copy to clipboard operation
llmware copied to clipboard

array out of bounds error in retrieval

Open chair300 opened this issue 1 year ago • 4 comments

When making a RAG request to of a semantic query I experienced the following stack trace. I am able to reproduce this.

File "/llmware/llmware/retrieval.py", line 670, in semantic_query results_dict = self._cursor_to_qr(query, qr_raw, result_count=result_count) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/llmware/llmware/retrieval.py", line 578, in _cursor_to_qr matches_found = self.locate_query_match(query, raw_qr["text"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/llmware/llmware/retrieval.py", line 1375, in locate_query_match if core_text[x].lower() == key_term[0].lower(): ~~~~~~~~^^^ IndexError: string index out of range

chair300 avatar Feb 28 '24 14:02 chair300

Can you please post a self-contained reproducible example so I can take a look at it?

MacOS avatar Feb 28 '24 19:02 MacOS

I am able to reproduce the issue if I have an extra space or double space in the the query text.

chair300 avatar Feb 29 '24 19:02 chair300

Please see https://github.com/llmware-ai/llmware/pull/470/commits/4f6a7b5402b5a1bd3751292d0bcba79340da0e23 which fixes the mentioned bug (inside https://github.com/llmware-ai/llmware/pull/470 pr)

ucekmez avatar Mar 01 '24 16:03 ucekmez

This does not fix the bug. I have submitted the fix already with PR#471

chair300 avatar Mar 01 '24 17:03 chair300