Spaces:
Running
Running
updated wrong utils.py
Browse files
ask_candid/retrieval/sources/utils.py
CHANGED
@@ -20,8 +20,9 @@ def get_context(field_name: str, hit: ElasticHitsResult, context_length: int = 1
|
|
20 |
|
21 |
chunks = []
|
22 |
# NOTE chunks have tokens, long text is a normal text, but may contain html that also gets weird after tokenization
|
23 |
-
long_text = hit.source.get(
|
24 |
long_text = long_text.lower()
|
|
|
25 |
inner_hits_field = f"embeddings.{field_name}.chunks"
|
26 |
found_chunks = hit.inner_hits.get(inner_hits_field, {})
|
27 |
if found_chunks:
|
|
|
20 |
|
21 |
chunks = []
|
22 |
# NOTE chunks have tokens, long text is a normal text, but may contain html that also gets weird after tokenization
|
23 |
+
long_text = hit.source.get(field_name) or ""
|
24 |
long_text = long_text.lower()
|
25 |
+
|
26 |
inner_hits_field = f"embeddings.{field_name}.chunks"
|
27 |
found_chunks = hit.inner_hits.get(inner_hits_field, {})
|
28 |
if found_chunks:
|