Skip to content

Query with no results returns ApiError instead of an empty fallback when metadata filters are applied #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alexander-zuev opened this issue Apr 27, 2025 · 2 comments

Comments

@alexander-zuev
Copy link

alexander-zuev commented Apr 27, 2025

Hey there 👋,

I've submitted this over support, but sharing more details here.

I am really looking forward to integrating Vectara into my app but unfortunately SDK (API under the hood) seems to return an error response in case metadata filters yield no results.

See this (dummy example):

  • When using a metadata filter
    "metadata_filter": "doc.user_id = '58f128ae-c2fa-4a02-a0b5-4f83258e3e'"
  • I receive this response
<Response [412]>
{"messages":["FAILED_PRECONDITION: Factual consistency computation skipped due to summarizer error."],"request_id":"70248967cd6771e2e4cc0ee6fa45e094"}

If I turn off metadata filter and send the exact same query + search params:
The response is

<Response [200]>
{"summary":"The returned results did not contain sufficient information..}

Here is the full code snippet I am using

`import json

import requests

url = "https://api.vectara.io/v2/corpora/kollektiv-mvp-dev/query"

payload = json.dumps(
    {
        "query": "Why did failed precondition error occur?",
        "search": {
            "custom_dimensions": {},
            # "metadata_filter": "doc.user_id = '58f128ae-c2fa-4a02-a0b5-4f83258e3e'",
            "lexical_interpolation": 0.025,
            "semantics": "default",
        },
        "generation": {
            "generation_preset_name": "vectara-summary-ext-v1.2.0",
            "max_used_search_results": 5,
            "max_response_characters": 300,
            "response_language": "eng",
            "citations": {
                "style": "none",
                "url_pattern": "https://vectara.com/documents/{doc.id}",
                "text_pattern": "{doc.title}",
            },
            "enable_factual_consistency_score": True,
        },
        "intelligent_query_rewriting": False,
    }
)
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "x-api-key": "api-key",
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response)
print(response.text)`

The same problem occurs with both SDK and API.

Also do note that
"enable_factual_consistency_score": False, - seems to affect nothing, the same error is produced when I set this to False or comment out the setting

If you'd like to me share more info / help debug - let me know!

Thanks!

@ofermend
Copy link
Collaborator

ofermend commented May 3, 2025

Hi @alexander-zuev - thanks for reporting this. We are working to fix this and apologies for the issue - should be fixed soon.
Separately, I see you are using "vectara-summary-ext-v1.2.0" in your query, please consider some of the alternative summarizers that might provide better results like "vectara-summary-table-query-ext-dec-2024-gpt-3-5" (assuming you want to keep GPT-3.5). Full list: https://docs.vectara.com/docs/learn/grounded-generation/select-a-summarizer

@alexander-zuev
Copy link
Author

Awesome looking forward to it!

Thanks for the tip regarding the summarizer - will ensure to switch to more modern ones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants