mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-11 19:56:03 +00:00
fix(mypy): resolve additional type errors in batches and together
- batches.py: Fix 6 cascading errors from body variable shadowing - together.py: Add type casts for Together API integration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
0c95140ca7
commit
a7866dff48
2 changed files with 14 additions and 10 deletions
|
|
@ -451,7 +451,7 @@ class ReferenceBatchesImpl(Batches):
|
|||
]
|
||||
|
||||
for param, expected_type, type_string in required_params:
|
||||
if param not in body:
|
||||
if param not in request_body:
|
||||
errors.append(
|
||||
BatchError(
|
||||
code="invalid_request",
|
||||
|
|
@ -461,7 +461,7 @@ class ReferenceBatchesImpl(Batches):
|
|||
)
|
||||
)
|
||||
valid = False
|
||||
elif not isinstance(body[param], expected_type):
|
||||
elif not isinstance(request_body[param], expected_type):
|
||||
errors.append(
|
||||
BatchError(
|
||||
code="invalid_request",
|
||||
|
|
@ -472,15 +472,15 @@ class ReferenceBatchesImpl(Batches):
|
|||
)
|
||||
valid = False
|
||||
|
||||
if "model" in body and isinstance(body["model"], str):
|
||||
if "model" in request_body and isinstance(request_body["model"], str):
|
||||
try:
|
||||
await self.models_api.get_model(body["model"])
|
||||
await self.models_api.get_model(request_body["model"])
|
||||
except Exception:
|
||||
errors.append(
|
||||
BatchError(
|
||||
code="model_not_found",
|
||||
line=line_num,
|
||||
message=f"Model '{body['model']}' does not exist or is not supported",
|
||||
message=f"Model '{request_body['model']}' does not exist or is not supported",
|
||||
param="body.model",
|
||||
)
|
||||
)
|
||||
|
|
@ -488,14 +488,14 @@ class ReferenceBatchesImpl(Batches):
|
|||
|
||||
if valid:
|
||||
assert isinstance(url, str), "URL must be a string" # for mypy
|
||||
assert isinstance(body, dict), "Body must be a dictionary" # for mypy
|
||||
assert isinstance(request_body, dict), "Body must be a dictionary" # for mypy
|
||||
requests.append(
|
||||
BatchRequest(
|
||||
line_num=line_num,
|
||||
url=url,
|
||||
method=request["method"],
|
||||
custom_id=request["custom_id"],
|
||||
body=body,
|
||||
body=request_body,
|
||||
),
|
||||
)
|
||||
except json.JSONDecodeError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue