ray-embedding 0.12.2__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ray-embedding
3
- Version: 0.12.2
3
+ Version: 0.12.3
4
4
  Summary: Deploy SentenceTransformers embedding models to a ray cluster
5
5
  Author: Crispin Almodovar
6
6
  Author-email:
@@ -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=500, detail=str(e))
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
- assert path_prefix in self.path_prefix, f"Invalid path prefix: {path_prefix}"
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}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ray-embedding
3
- Version: 0.12.2
3
+ Version: 0.12.3
4
4
  Summary: Deploy SentenceTransformers embedding models to a ray cluster
5
5
  Author: Crispin Almodovar
6
6
  Author-email:
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = ray-embedding
3
- version = 0.12.2
3
+ version = 0.12.3
4
4
  author = Crispin Almodovar
5
5
  author_email =
6
6
  description = Deploy SentenceTransformers embedding models to a ray cluster
File without changes