Skip to content

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

Open
@alexander-zuev

Description

@alexander-zuev

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions