mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-03 08:23:16 +00:00
Fix failing tests
This commit is contained in:
@@ -643,7 +643,10 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):
|
||||
if not isinstance(item, dict):
|
||||
return
|
||||
try:
|
||||
output_index = int(parsed_chunk.get("output_index"))
|
||||
output_index_raw = parsed_chunk.get("output_index")
|
||||
if output_index_raw is None:
|
||||
raise ValueError("missing output_index")
|
||||
output_index = int(output_index_raw)
|
||||
except (TypeError, ValueError):
|
||||
output_index = len(recovered_output_items)
|
||||
recovered_output_items[output_index] = item
|
||||
@@ -660,7 +663,10 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):
|
||||
return
|
||||
|
||||
try:
|
||||
output_index = int(parsed_chunk.get("output_index"))
|
||||
output_index_raw = parsed_chunk.get("output_index")
|
||||
if output_index_raw is None:
|
||||
raise ValueError("missing output_index")
|
||||
output_index = int(output_index_raw)
|
||||
except (TypeError, ValueError):
|
||||
output_index = len(recovered_text_only_items)
|
||||
|
||||
@@ -682,7 +688,10 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):
|
||||
return
|
||||
|
||||
try:
|
||||
content_index = int(parsed_chunk.get("content_index"))
|
||||
content_index_raw = parsed_chunk.get("content_index")
|
||||
if content_index_raw is None:
|
||||
raise ValueError("missing content_index")
|
||||
content_index = int(content_index_raw)
|
||||
except (TypeError, ValueError):
|
||||
content_index = len(content)
|
||||
|
||||
@@ -789,8 +798,8 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):
|
||||
logging_obj
|
||||
)
|
||||
if recovered_output_items:
|
||||
output_items = recovered_output_items
|
||||
raw_response.output = recovered_output_items
|
||||
output_items = cast(Any, recovered_output_items)
|
||||
raw_response.output = cast(Any, recovered_output_items)
|
||||
verbose_logger.warning(
|
||||
"Recovered empty Responses API output from raw SSE for model=%s",
|
||||
model,
|
||||
|
||||
@@ -213,6 +213,8 @@ class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig):
|
||||
if not isinstance(item, dict):
|
||||
return
|
||||
try:
|
||||
if output_index is None:
|
||||
raise ValueError("missing output_index")
|
||||
index = int(output_index)
|
||||
except (TypeError, ValueError):
|
||||
index = len(streamed_output_items)
|
||||
|
||||
@@ -131,11 +131,12 @@ def build_pages_from_reducto(result: Dict[str, Any]) -> List["OCRPage"]:
|
||||
block.get("content", "") for block in blocks if block.get("content")
|
||||
)
|
||||
page_index = max(page_no - 1, 0)
|
||||
pages.append(
|
||||
OCRPage(
|
||||
index=page_index,
|
||||
markdown=markdown,
|
||||
blocks=blocks,
|
||||
)
|
||||
page = OCRPage(
|
||||
index=page_index,
|
||||
markdown=markdown,
|
||||
)
|
||||
# OCRPage accepts extra keys at runtime; assign blocks after construction
|
||||
# so static typing does not reject provider-specific metadata.
|
||||
setattr(page, "blocks", blocks)
|
||||
pages.append(page)
|
||||
return pages
|
||||
|
||||
@@ -45,7 +45,7 @@ class VertexBase:
|
||||
self._credentials: Optional[GoogleCredentialsObject] = None
|
||||
self._credentials_project_mapping: Dict[
|
||||
Tuple[Optional[VERTEX_CREDENTIALS_TYPES], Optional[str]],
|
||||
Tuple[GoogleCredentialsObject, str],
|
||||
Tuple[GoogleCredentialsObject, Optional[str]],
|
||||
] = {}
|
||||
self.project_id: Optional[str] = None
|
||||
self.async_handler: Optional[AsyncHTTPHandler] = None
|
||||
|
||||
Reference in New Issue
Block a user