adjust vespa fields

This commit is contained in:
Weves 2023-10-31 16:59:52 -07:00
parent f4e80c9f22
commit 22d7427e45
3 changed files with 21 additions and 3 deletions

View File

@ -31,6 +31,8 @@ schema danswer_chunk {
# https://docs.vespa.ai/en/attributes.html potential enum store for speed, but probably not worth it
field source_type type string {
indexing: summary | attribute
rank: filter
attribute: fast-search
}
# Can also index links https://docs.vespa.ai/en/reference/schema-reference.html#attribute
# URL type matching
@ -61,6 +63,8 @@ schema danswer_chunk {
}
field hidden type bool {
indexing: summary | attribute
rank: filter
attribute: fast-search
}
field metadata type string {
indexing: summary | attribute
@ -82,10 +86,12 @@ schema danswer_chunk {
}
field access_control_list type weightedset<string> {
indexing: summary | attribute
rank: filter
attribute: fast-search
}
field document_sets type weightedset<string> {
indexing: summary | attribute
rank: filter
attribute: fast-search
}
}

View File

@ -436,10 +436,20 @@ def _query_vespa(query_params: Mapping[str, str | int]) -> list[InferenceChunk]:
raise ValueError("No/empty query received")
logger.info("Making query with params: %s", query_params)
response = requests.get(SEARCH_ENDPOINT, params=query_params)
response = requests.get(
SEARCH_ENDPOINT,
params=dict(
**query_params,
**{
"presentation.timing": True,
},
),
)
response.raise_for_status()
hits = response.json()["root"].get("children", [])
response_json = response.json()
logger.info("Response: %s", response_json)
hits = response_json["root"].get("children", [])
for hit in hits:
if hit["fields"].get(CONTENT) is None:

View File

@ -133,10 +133,12 @@ def _measure_vespa_latency(filters: dict = {}):
"hits": num_to_retrieve,
"offset": 0,
"ranking.profile": os.environ.get("VESPA_RANKING_PROFILE", "hybrid_search"),
"presentation.timing": True,
"timeout": "10s",
}
start = time.monotonic()
_query_vespa(params)
response = _query_vespa(params)
print(response)
return time.monotonic() - start