mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix: resolve mypy type errors in anthropic transformation
This commit is contained in:
parent
d3894ebd4f
commit
f9de88f930
1 changed files with 4 additions and 4 deletions
|
|
@ -171,7 +171,7 @@ class SnowflakeCortexAnthropicConfig(SnowflakeBaseConfig):
|
|||
for msg in messages:
|
||||
if isinstance(msg, dict):
|
||||
role = msg.get("role", "")
|
||||
content = msg.get("content", "")
|
||||
content: Any = msg.get("content", "")
|
||||
else:
|
||||
role = getattr(msg, "role", "")
|
||||
content = getattr(msg, "content", "")
|
||||
|
|
@ -184,11 +184,11 @@ class SnowflakeCortexAnthropicConfig(SnowflakeBaseConfig):
|
|||
if isinstance(msg, dict)
|
||||
else getattr(msg, "tool_calls", None)
|
||||
)
|
||||
if tool_calls:
|
||||
if tool_calls: # type: ignore[truthy-bool]
|
||||
content_blocks: List[Dict[str, Any]] = []
|
||||
if content:
|
||||
content_blocks.append({"type": "text", "text": content})
|
||||
for tc in tool_calls:
|
||||
for tc in tool_calls: # type: ignore[union-attr]
|
||||
func = (
|
||||
tc.get("function", {})
|
||||
if isinstance(tc, dict)
|
||||
|
|
@ -385,7 +385,7 @@ class SnowflakeCortexAnthropicConfig(SnowflakeBaseConfig):
|
|||
)
|
||||
|
||||
model_response.choices = [choice]
|
||||
model_response.usage = usage
|
||||
model_response.usage = usage # type: ignore[assignment]
|
||||
model_response.model = "snowflake/" + response_json.get("model", model)
|
||||
model_response.id = response_json.get("id", "")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue