Skip to content

Commit

Permalink
fix: tei_fast_rerank logic bump:patch
Browse files Browse the repository at this point in the history
  • Loading branch information
taprosoft committed Dec 17, 2024
1 parent 54320d0 commit 3bd19f3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions libs/kotaemon/kotaemon/rerankings/tei_fast_rerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,18 @@ class TeiFastReranking(BaseReranking):
),
)
is_truncated: Optional[bool] = Param(True, help="Whether to truncate the inputs")
max_tokens: Optional[int] = Param(512, help="This option is used to specify the maximum number of tokens supported by the reranker model.")
max_tokens: Optional[int] = Param(
512,
help=(
"This option is used to specify the "
"maximum number of tokens supported by the reranker model."
),
)

def client(self, query, texts):
if self.is_truncated == True:
max_tokens = self.max_tokens # default is 512 tokens.
truncated_texts = [text[:max_tokens] for text in texts]
if self.is_truncated:
max_tokens = self.max_tokens # default is 512 tokens.
truncated_texts = [text[:max_tokens] for text in texts]

response = session.post(
url=self.endpoint_url,
Expand Down

0 comments on commit 3bd19f3

Please sign in to comment.