Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: UI tab name and reranking process for TeiFastReranking #530

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ activate*
activate/*
kotaemon-env*
.env
workdir*
workdir/*
run_container.sh
Makefile
Dockerfile

### Emacs ###
# -*- mode: gitignore; -*-
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ RUN bash scripts/download_pdfjs.sh $PDFJS_PREBUILT_DIR
COPY . /app
COPY .env.example /app/.env

# Update pip command
RUN pip install --upgrade pip

# Install pip packages
RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cache/pip \
pip install -e "libs/kotaemon" \
&& pip install -e "libs/ktem" \
&& pip install "pdfservices-sdk@git+https://github.com/niallcm/pdfservices-python-sdk.git@bump-and-unfreeze-requirements"
&& pip install "pdfservices-sdk@git+https://github.com/niallcm/pdfservices-python-sdk.git@bump-and-unfreeze-requirements" \
&& pip install "docling"

RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cache/pip \
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/app/ext/user-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Once enabled, you have access to the following features:

- User login/logout (located in Settings Tab)
- User changing password (located in Settings Tab)
- Create / List / Edit / Delete user (located in Admin > User Management Tab)
- Create / List / Edit / Delete user (located in Resources > Users Tab)
7 changes: 6 additions & 1 deletion libs/kotaemon/kotaemon/rerankings/tei_fast_rerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +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.")

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]

response = session.post(
url=self.endpoint_url,
json={
"query": query,
"texts": texts,
"texts": truncated_texts,
"is_truncated": self.is_truncated, # default is True
},
).json()
Expand Down