mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-11 05:36:03 +02:00
Fix Title for docs without (#1827)
This commit is contained in:
@@ -605,7 +605,7 @@ def _vespa_hit_to_inference_chunk(
|
|||||||
section_continuation=fields[SECTION_CONTINUATION],
|
section_continuation=fields[SECTION_CONTINUATION],
|
||||||
document_id=fields[DOCUMENT_ID],
|
document_id=fields[DOCUMENT_ID],
|
||||||
source_type=fields[SOURCE_TYPE],
|
source_type=fields[SOURCE_TYPE],
|
||||||
title=fields[TITLE],
|
title=fields.get(TITLE),
|
||||||
semantic_identifier=fields[SEMANTIC_IDENTIFIER],
|
semantic_identifier=fields[SEMANTIC_IDENTIFIER],
|
||||||
boost=fields.get(BOOST, 1),
|
boost=fields.get(BOOST, 1),
|
||||||
recency_bias=fields.get("matchfeatures", {}).get(RECENCY_BIAS, 1.0),
|
recency_bias=fields.get("matchfeatures", {}).get(RECENCY_BIAS, 1.0),
|
||||||
@@ -614,7 +614,7 @@ def _vespa_hit_to_inference_chunk(
|
|||||||
primary_owners=fields.get(PRIMARY_OWNERS),
|
primary_owners=fields.get(PRIMARY_OWNERS),
|
||||||
secondary_owners=fields.get(SECONDARY_OWNERS),
|
secondary_owners=fields.get(SECONDARY_OWNERS),
|
||||||
metadata=metadata,
|
metadata=metadata,
|
||||||
metadata_suffix=fields.get(METADATA_SUFFIX) or "",
|
metadata_suffix=fields.get(METADATA_SUFFIX),
|
||||||
match_highlights=match_highlights,
|
match_highlights=match_highlights,
|
||||||
updated_at=updated_at,
|
updated_at=updated_at,
|
||||||
)
|
)
|
||||||
|
@@ -190,11 +190,12 @@ class InferenceChunk(BaseChunk):
|
|||||||
|
|
||||||
|
|
||||||
class InferenceChunkUncleaned(InferenceChunk):
|
class InferenceChunkUncleaned(InferenceChunk):
|
||||||
title: str # Separate from Semantic Identifier though often same
|
title: str | None # Separate from Semantic Identifier though often same
|
||||||
metadata_suffix: str
|
metadata_suffix: str | None
|
||||||
|
|
||||||
def to_inference_chunk(self) -> InferenceChunk:
|
def to_inference_chunk(self) -> InferenceChunk:
|
||||||
# Create a dict of all fields except 'title' and 'metadata_suffix'
|
# Create a dict of all fields except 'title' and 'metadata_suffix'
|
||||||
|
# Assumes the cleaning has already been applied and just needs to translate to the right type
|
||||||
inference_chunk_data = {
|
inference_chunk_data = {
|
||||||
k: v
|
k: v
|
||||||
for k, v in self.dict().items()
|
for k, v in self.dict().items()
|
||||||
|
Reference in New Issue
Block a user