Skip to content

Commit

Permalink
add max size (#489)
Browse files Browse the repository at this point in the history
* add max size

* bump version
  • Loading branch information
michaelfeil authored Dec 6, 2024
1 parent 1b98bf9 commit be48378
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/assets/openapi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libs/client_infinity/infinity_client/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "infinity_client"
version = "0.0.71"
version = "0.0.72"
description = "A client library for accessing ♾️ Infinity - Embedding Inference Server"
authors = []
readme = "README.md"
Expand Down
10 changes: 9 additions & 1 deletion libs/infinity_emb/infinity_emb/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ def cache_dir(self) -> Path:

@cached_property
def queue_size(self) -> int:
return int(self._optional_infinity_var("queue_size", default="32000"))
size = int(self._optional_infinity_var("queue_size", default="32000"))
assert size > 0, "INFINITY_QUEUE_SIZE must be a positive number"
return size

@cached_property
def max_client_batch_size(self) -> int:
size = int(self._optional_infinity_var("max_client_batch_size", default="2048"))
assert size > 0, "INFINITY_MAX_CLIENT_BATCH_SIZE must be a positive number"
return size

@cached_property
def permissive_cors(self):
Expand Down
5 changes: 3 additions & 2 deletions libs/infinity_emb/infinity_emb/fastapi_schemas/pydantic_v2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pydantic import AnyUrl, HttpUrl, StringConstraints
from infinity_emb.env import MANAGER

__all__ = [
"INPUT_STRING",
Expand All @@ -14,9 +15,9 @@
INPUT_STRING = StringConstraints(max_length=8192 * 15, strip_whitespace=True)
ITEMS_LIMIT = {
"min_length": 1,
"max_length": 2048,
"max_length": MANAGER.max_client_batch_size,
}
ITEMS_LIMIT_SMALL = {
"min_length": 1,
"max_length": 32,
"max_length": min(32, MANAGER.max_client_batch_size),
}
2 changes: 1 addition & 1 deletion libs/infinity_emb/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

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

0 comments on commit be48378

Please sign in to comment.