Hello Vectara Community,
I’ve encountered an issue that I’m hoping someone else might have experience with. I’m using the Vectara API to perform some queries on a corpus and am running into inconsistent behavior when using both the lambda
parameter in lexicalInterpolationConfig
and metadataFilter
.
Expected Behavior:
When I query without applying any metadataFilter
, I observe that different lambda
values yield different results, which is the expected behavior.
Issue:
However, when I add even loose metadataFilter
conditions, the results start to become the same irrespective of the lambda
value I supply. This is unexpected and counterintuitive.
Here is a simplified example of the JSON queries:
Without Metadata Filter (Different results for different lambda values)
{
"query": "example search term",
"lexicalInterpolationConfig": {
"lambda": 1
}
}
With Metadata Filter (Same results regardless of lambda value)
{
"query": "example search term",
"lexicalInterpolationConfig": {
"lambda": 1
},
"metadataFilter": "doc.country_iso_2='us' and doc.date>='2022-01-01' and doc.date<='2023-08-27'"
}
Has anyone else experienced this issue, or does anyone have any insights into why this might be happening?
I appreciate any help or suggestions!
On the console, can you construct the same query with filter and grab the cURL version of your query and share with us?
Thanks, Talip. In the request below, keeping doc.country_iso_2='us'
shouldn’t restrict the output since all of the docs have a country_iso_2='us'
. However, adding this metadata filter makes it so the same output is returned regardless of the lambda value. If you remove this filter and pass different lambdas, you see different results (as expected).
curl -X POST \
-H "Authorization: Bearer eyJraWQiOiJvUnVNVmNrXC9DRFN2R2RDa2ViVEc2SVIwM0NCbmtlbnRISjFkNGFEZUZpUT0iLCJhbGciOiJSUzI1NiJ9.eyJhdF9oYXNoIjoiV254Q0l2d0pic2QxR2FoeHdvTGRhUSIsInN1YiI6IjY1ODU4MTRlLWM3YzQtNGE5Ny04Mjk0LTk0YzFjMzUzMDNhMSIsImNvZ25pdG86Z3JvdXBzIjpbInVzLXdlc3QtMl9KMFZqQnd6b1dfR29vZ2xlIl0sImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAudXMtd2VzdC0yLmFtYXpvbmF3cy5jb21cL3VzLXdlc3QtMl9KMFZqQnd6b1ciLCJjb2duaXRvOnVzZXJuYW1lIjoiR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"query": [
{
"query": "inflation is transitory",
"queryContext": "",
"start": 0,
"numResults": 10,
"contextConfig": {
"charsBefore": 0,
"charsAfter": 0,
"sentencesBefore": 2,
"sentencesAfter": 2,
"startTag": "%START_SNIPPET%",
"endTag": "%END_SNIPPET%"
},
"corpusKey": [
{
"customerId": 3279618736,
"corpusId": 2,
"semantics": 0,
"metadataFilter": "doc.country_iso_2='us'",
"lexicalInterpolationConfig": {
"lambda": 0
},
"dim": []
}
],
"summary": []
}
]
}
END
We are able to reproduce the issue. Thank you for reporting. ETA for the fix is next week.
1 Like
Hi Talip, has this been resolved yet? Thanks
Can you please try it again and let me know?
I have an issue for the AND Filter