fix(mypy): resolve type issues in MongoDB, batches, and auth providers (#3933)

Fixes mypy type errors in provider utilities:
- MongoDB: Fix AsyncMongoClient parameters, use async iteration for
cursor
- Batches: Handle memoryview|bytes union for file decoding
- Auth: Add missing imports, validate JWKS URI, conditionally pass
parameters

Fixes 11 type errors. No functional changes.
This commit is contained in:
Ashwin Bharambe 2025-10-28 10:23:39 -07:00 committed by GitHub
parent 4a2ea278c5
commit 6ce59b5df8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 29 deletions

View file

@ -358,7 +358,11 @@ class ReferenceBatchesImpl(Batches):
# TODO(SECURITY): do something about large files
file_content_response = await self.files_api.openai_retrieve_file_content(batch.input_file_id)
file_content = file_content_response.body.decode("utf-8")
# Handle both bytes and memoryview types
body = file_content_response.body
if isinstance(body, memoryview):
body = bytes(body)
file_content = body.decode("utf-8")
for line_num, line in enumerate(file_content.strip().split("\n"), 1):
if line.strip(): # skip empty lines
try: