fix(mypy): widen file-ref helper input type, annotate empty list

- _resolve_file_references / _async_resolve_file_references: param type
  EmbeddingInput → Union[EmbeddingInput, List[str]]. Two of the four
  call sites pass flat_elements (List[str]) post-410f54dc72; the
  function body already handles both shapes at runtime — only the type
  was lying.
- transform_openai_input_gemini_content: annotate text_elements as
  List[str] for the var-annotated rule.
This commit is contained in:
Chesars 2026-04-25 18:00:00 -03:00
parent 303dd6b8f6
commit b910ae47e7
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class GoogleBatchEmbeddings(VertexLLM):
def _resolve_file_references(
self,
input: EmbeddingInput,
input: Union[EmbeddingInput, List[str]],
api_key: str,
sync_handler: HTTPHandler,
) -> Dict[str, Dict[str, str]]:
@ -87,7 +87,7 @@ class GoogleBatchEmbeddings(VertexLLM):
async def _async_resolve_file_references(
self,
input: EmbeddingInput,
input: Union[EmbeddingInput, List[str]],
api_key: str,
async_handler: AsyncHTTPHandler,
) -> Dict[str, Dict[str, str]]:

View File

@ -361,7 +361,7 @@ def process_response(
has_nested = isinstance(input, list) and any(isinstance(e, list) for e in input)
if _is_multimodal_input(input) or has_nested:
input_list = input if isinstance(input, list) else [input]
text_elements = []
text_elements: List[str] = []
for e in input_list:
if isinstance(e, list):
text_elements.extend(