rkuo-danswer c8d13922a9
rename classes and ignore deprecation warnings we mostly don't have c… (#2546)
* rename classes and ignore deprecation warnings we mostly don't have control over

* copy pytest.ini

* ignore CryptographyDeprecationWarning

* fully qualify the warning
2024-09-24 00:21:42 +00:00

28 lines
842 B
Python

import requests
from danswer.document_index.vespa.index import DOCUMENT_ID_ENDPOINT
class vespa_fixture:
def __init__(self, index_name: str):
self.index_name = index_name
self.vespa_document_url = DOCUMENT_ID_ENDPOINT.format(index_name=index_name)
def get_documents_by_id(
self, document_ids: list[str], wanted_doc_count: int = 1_000
) -> dict:
selection = " or ".join(
f"{self.index_name}.document_id=='{document_id}'"
for document_id in document_ids
)
params = {
"selection": selection,
"wantedDocumentCount": wanted_doc_count,
}
response = requests.get(
self.vespa_document_url,
params=params, # type: ignore
)
response.raise_for_status()
return response.json()