TEI auto truncate inputs (#10916)

### What problem does this PR solve?

TEI auto truncate inputs

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Zhichang Yu
2025-10-31 16:46:20 +08:00
committed by GitHub
parent f52e56c2d6
commit fe4852cb71
2 changed files with 3 additions and 3 deletions

View File

@ -203,7 +203,7 @@ services:
env_file: .env
networks:
- ragflow
command: ["--model-id", "/data/${TEI_MODEL}"]
command: ["--model-id", "/data/${TEI_MODEL}", "--auto-truncate"]
restart: on-failure
@ -217,7 +217,7 @@ services:
env_file: .env
networks:
- ragflow
command: ["--model-id", "/data/${TEI_MODEL}"]
command: ["--model-id", "/data/${TEI_MODEL}", "--auto-truncate"]
deploy:
resources:
reservations:

View File

@ -82,7 +82,7 @@ class BuiltinEmbed(Base):
def encode(self, texts: list):
batch_size = 16
texts = [truncate(t, self._max_tokens) for t in texts]
# TEI is able to auto truncate inputs according to https://github.com/huggingface/text-embeddings-inference.
token_count = 0
ress = None
for i in range(0, len(texts), batch_size):