Skip to content

Commit 3f68f52

Browse files
committed
Added description to Context.score, with updated default value of -1
1 parent 1b57725 commit 3f68f52

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/paperqa/types.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ class Context(BaseModel):
216216
# or useful excerpts of text
217217
model_config = ConfigDict(extra="allow")
218218

219+
# Value was chosen to be below a 0-10 scale, making the 'unset' nature obvious
220+
UNSET_RELEVANCE: ClassVar[int] = -1
221+
219222
id: str = Field(
220223
default=AUTOPOPULATE_VALUE,
221224
description="Unique identifier for the context. Auto-generated if not provided.",
@@ -236,7 +239,15 @@ class Context(BaseModel):
236239
),
237240
)
238241
text: Text
239-
score: int = 5
242+
score: int = Field(
243+
default=UNSET_RELEVANCE,
244+
description=(
245+
"Relevance score for this context to the question."
246+
" The range used here is 0-10, where 0 is 'irrelevant',"
247+
" 1 is barely relevant, and 10 is most relevant."
248+
" The default is -1 to have a 'sorting safe' default as sub-relevant."
249+
),
250+
)
240251

241252
CONTEXT_ENCODING_LENGTH: ClassVar[int] = 500 # chars
242253
ID_HASH_LENGTH: ClassVar[int] = 8 # chars

0 commit comments

Comments
 (0)