run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
36.99k stars 5.3k forks source link

[Bug]: Auto-Retrieval doesnt work as documented #16871

Open MistyIce672 opened 2 weeks ago

MistyIce672 commented 2 weeks ago

Bug Description

i was following the documentation for the auto retrieval example but even when following the steps one to one i run into this error

nodes = retriever.retrieve(
    "Tell me about some books/movies after the year 2000"
)
PineconeApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 08 Nov 2024 02:05:12 GMT', 'Content-Type': 'application/json', 'Content-Length': '103', 'Connection': 'keep-alive', 'x-pinecone-request-latency-ms': '31', 'x-pinecone-request-id': '8973486044126597335', 'x-envoy-upstream-service-time': '2', 'server': 'envoy'})
HTTP response body: {"code":3,"message":"the $gt operator must be followed by a number, got \"2000\" instead","details":[]}

the code does work if the retriever is not number related but still never returns more than one result

Version

Version: 0.11.22

Steps to Reproduce

htt[ps://docs.llamaindex.ai/en/stable/examples/vector_stores/pinecone_auto_retriever/](lama index guide)

Relevant Logs/Tracbacks

No response

dosubot[bot] commented 2 weeks ago

Hey @MistyIce672! I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together!

The error you're encountering, PineconeApiException: (400), indicates that the $gt operator is being used incorrectly. The message specifies that the operator must be followed by a number, but it received a string ("2000") instead. This suggests that the query is not correctly formatted to handle numerical comparisons.

To resolve this issue, ensure that the value following the $gt operator is a numerical type rather than a string. You might need to adjust the query to explicitly convert "2000" into a number if it's being interpreted as a string. This could involve modifying the query construction to ensure that numerical values are correctly recognized as such.

Additionally, if the retriever is not returning more than one result, it might be due to the configuration of the query or the index. Check the settings for the number of results to retrieve and ensure that the index is properly set up to handle the type of queries you're making.

If these adjustments do not resolve the issue, reviewing the documentation or example code for any specific instructions on handling numerical queries with Pinecone in LlamaIndex might provide further insights.

To continue talking to Dosu, mention @dosu.

logan-markewich commented 2 weeks ago

Yea sometimes the LLM predicts is an int, sometimes as a string

Probably there should be some step that casts the filter values to the type specified in the VectorStoreInfo object

MistyIce672 commented 2 weeks ago

Yea sometimes the LLM predicts is an int, sometimes as a string

Probably there should be some step that casts the filter values to the type specified in the VectorStoreInfo object

yeah there is step that sets the type for each metadata field which i have followed so the it should automatically convert it to int when that field is detected in the query but something seems to not work

slyapustin commented 2 weeks ago

@MistyIce672 Did you solved that? Run in to the same issue today: https://github.com/run-llama/llama_index/issues/16908

MistyIce672 commented 1 week ago

@slyapustin nope im still facing the issue and haven't found a working solution