Skip to content

Commit be48378

Browse files
authored
add max size (michaelfeil#489)
* add max size * bump version
1 parent 1b98bf9 commit be48378

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

docs/assets/openapi.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

libs/client_infinity/infinity_client/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "infinity_client"
3-
version = "0.0.71"
3+
version = "0.0.72"
44
description = "A client library for accessing ♾️ Infinity - Embedding Inference Server"
55
authors = []
66
readme = "README.md"

libs/infinity_emb/infinity_emb/env.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,15 @@ def cache_dir(self) -> Path:
189189

190190
@cached_property
191191
def queue_size(self) -> int:
192-
return int(self._optional_infinity_var("queue_size", default="32000"))
192+
size = int(self._optional_infinity_var("queue_size", default="32000"))
193+
assert size > 0, "INFINITY_QUEUE_SIZE must be a positive number"
194+
return size
195+
196+
@cached_property
197+
def max_client_batch_size(self) -> int:
198+
size = int(self._optional_infinity_var("max_client_batch_size", default="2048"))
199+
assert size > 0, "INFINITY_MAX_CLIENT_BATCH_SIZE must be a positive number"
200+
return size
193201

194202
@cached_property
195203
def permissive_cors(self):

libs/infinity_emb/infinity_emb/fastapi_schemas/pydantic_v2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pydantic import AnyUrl, HttpUrl, StringConstraints
2+
from infinity_emb.env import MANAGER
23

34
__all__ = [
45
"INPUT_STRING",
@@ -14,9 +15,9 @@
1415
INPUT_STRING = StringConstraints(max_length=8192 * 15, strip_whitespace=True)
1516
ITEMS_LIMIT = {
1617
"min_length": 1,
17-
"max_length": 2048,
18+
"max_length": MANAGER.max_client_batch_size,
1819
}
1920
ITEMS_LIMIT_SMALL = {
2021
"min_length": 1,
21-
"max_length": 32,
22+
"max_length": min(32, MANAGER.max_client_batch_size),
2223
}

libs/infinity_emb/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[tool.poetry]
33
name = "infinity_emb"
4-
version = "0.0.71"
4+
version = "0.0.72"
55
description = "Infinity is a high-throughput, low-latency REST API for serving text-embeddings, reranking models and clip."
66
authors = ["michaelfeil <noreply@michaelfeil.eu>"]
77
license = "MIT"

0 commit comments

Comments
 (0)