mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-12 08:42:18 +00:00
style(voyage): format multimodal embedding transformation to satisfy ruff
The copy of transformation_multimodal.py on the base branch carries a few lines that exceed the 88 char limit (the httpx.Request construction, a comprehension and two error constructions). Wrap them so ruff format --check passes on the merged result
This commit is contained in:
parent
752ee2f6cc
commit
315ba0e613
1 changed files with 13 additions and 4 deletions
|
|
@ -27,7 +27,9 @@ class VoyageMultimodalEmbeddingError(BaseLLMException):
|
|||
):
|
||||
self.status_code = status_code
|
||||
self.message = message
|
||||
self.request = httpx.Request(method="POST", url="https://api.voyageai.com/v1/multimodalembeddings")
|
||||
self.request = httpx.Request(
|
||||
method="POST", url="https://api.voyageai.com/v1/multimodalembeddings"
|
||||
)
|
||||
self.response = httpx.Response(status_code=status_code, request=self.request)
|
||||
super().__init__(
|
||||
status_code=status_code,
|
||||
|
|
@ -133,7 +135,10 @@ class VoyageMultimodalEmbeddingConfig(BaseEmbeddingConfig):
|
|||
content = item.get("content") or []
|
||||
return {
|
||||
**item,
|
||||
"content": [self._normalize_content_item(content_item) for content_item in content],
|
||||
"content": [
|
||||
self._normalize_content_item(content_item)
|
||||
for content_item in content
|
||||
],
|
||||
}
|
||||
return item
|
||||
|
||||
|
|
@ -165,7 +170,9 @@ class VoyageMultimodalEmbeddingConfig(BaseEmbeddingConfig):
|
|||
try:
|
||||
raw_response_json = raw_response.json()
|
||||
except Exception:
|
||||
raise VoyageMultimodalEmbeddingError(message=raw_response.text, status_code=raw_response.status_code)
|
||||
raise VoyageMultimodalEmbeddingError(
|
||||
message=raw_response.text, status_code=raw_response.status_code
|
||||
)
|
||||
|
||||
model_response.model = raw_response_json.get("model")
|
||||
model_response.data = raw_response_json.get("data")
|
||||
|
|
@ -182,4 +189,6 @@ class VoyageMultimodalEmbeddingConfig(BaseEmbeddingConfig):
|
|||
def get_error_class(
|
||||
self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers]
|
||||
) -> BaseLLMException:
|
||||
return VoyageMultimodalEmbeddingError(message=error_message, status_code=status_code, headers=headers)
|
||||
return VoyageMultimodalEmbeddingError(
|
||||
message=error_message, status_code=status_code, headers=headers
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue