mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-11 19:56:03 +00:00
fix(mypy): resolve type issues in MongoDB, batches, and auth providers
Resolves typing issues across provider utilities: **MongoDB (6 errors fixed):** - Fix AsyncMongoClient parameter dict unpacking by building typed dict with None filtering - Fix AsyncCursor synchronous iteration - use async for loop **Batches (1 error fixed):** - Handle memoryview|bytes union type for file content decoding **Auth Providers (4 errors fixed):** - Add missing Any import - Ensure JWKS URI is not None with validation - Only pass lifespan parameter when configured (let library use its default) - Conditionally build httpx post kwargs to avoid passing None for auth Fixes 11 mypy type errors in provider utility layer.
This commit is contained in:
parent
41a65b87e6
commit
f34b6288cc
3 changed files with 52 additions and 29 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue