ray-embedding 0.12.1__tar.gz → 0.12.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ray-embedding might be problematic. Click here for more details.
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/PKG-INFO +1 -1
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding/model_router.py +8 -6
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding.egg-info/PKG-INFO +1 -1
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/setup.cfg +1 -1
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/README.md +0 -0
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/pyproject.toml +0 -0
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding/__init__.py +0 -0
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding/deploy.py +0 -0
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding/dto.py +0 -0
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding/embedding_model.py +0 -0
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding.egg-info/SOURCES.txt +0 -0
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding.egg-info/dependency_links.txt +0 -0
- {ray_embedding-0.12.1 → ray_embedding-0.12.3}/ray_embedding.egg-info/top_level.txt +0 -0
|
@@ -65,7 +65,7 @@ class ModelRouter:
|
|
|
65
65
|
return [emb for result in all_results for emb in result]
|
|
66
66
|
|
|
67
67
|
async def _rate_limited_embedding_call(self, model_handle: DeploymentHandle, batch: List[str], dimensions: int):
|
|
68
|
-
with self.rate_limiter:
|
|
68
|
+
async with self.rate_limiter:
|
|
69
69
|
return await model_handle.remote(batch, dimensions)
|
|
70
70
|
|
|
71
71
|
async def _retry_failed_embedding_call(self, model_handle: DeploymentHandle, batch: List[str],
|
|
@@ -88,10 +88,10 @@ class ModelRouter:
|
|
|
88
88
|
|
|
89
89
|
@web_api.post("/{path_prefix}/v1/embeddings", response_model=EmbeddingResponse)
|
|
90
90
|
async def compute_embeddings(self, path_prefix: str, request: EmbeddingRequest):
|
|
91
|
-
assert path_prefix in self.path_prefix, f"Invalid path prefix: {path_prefix}"
|
|
92
|
-
assert request.model in self.deployed_models, f"Invalid model: {request.model}"
|
|
93
|
-
|
|
94
91
|
try:
|
|
92
|
+
assert path_prefix in self.path_prefix, f"The API path prefix specified is invalid: '{path_prefix}'"
|
|
93
|
+
assert request.model in self.deployed_models, f"The model specified is invalid: {request.model}"
|
|
94
|
+
|
|
95
95
|
inputs = request.input if isinstance(request.input, list) else [request.input]
|
|
96
96
|
self.logger.info(f"Computing embeddings for a batch of {len(inputs)} texts using model: {request.model}")
|
|
97
97
|
embeddings = await self._compute_embeddings_from_resized_batches(request.model, inputs, request.dimensions)
|
|
@@ -101,11 +101,13 @@ class ModelRouter:
|
|
|
101
101
|
]
|
|
102
102
|
return EmbeddingResponse(object="list", data=response_data, model=request.model)
|
|
103
103
|
except Exception as e:
|
|
104
|
+
status_code = 400 if isinstance(e, AssertionError) else 500
|
|
104
105
|
self.logger.error(f"Failed to create embeddings: {e}")
|
|
105
|
-
raise HTTPException(status_code=
|
|
106
|
+
raise HTTPException(status_code=status_code, detail=str(e))
|
|
106
107
|
|
|
107
108
|
@web_api.get("/{path_prefix}/v1/models")
|
|
108
109
|
async def list_models(self, path_prefix: str):
|
|
109
110
|
"""Returns the list of available models in OpenAI-compatible format."""
|
|
110
|
-
|
|
111
|
+
if path_prefix not in self.path_prefix:
|
|
112
|
+
raise HTTPException(status_code=400, detail=f"The API path prefix specified is invalid: '{path_prefix}'")
|
|
111
113
|
return {"object": "list", "data": self.available_models}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|