Skip to content

Commit d78ed53

Browse files
committed
fix mypy linting
1 parent 199c262 commit d78ed53

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

litellm/llms/databricks/chat/transformation.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,14 @@ def convert_anthropic_tool_to_databricks_tool(
169169
if tool is None:
170170
return None
171171

172-
kwags = {
173-
"name":tool["name"],
174-
"parameters":cast(dict, tool.get("input_schema") or {})
172+
kwags: dict = {
173+
"name": tool["name"],
174+
"parameters": cast(dict, tool.get("input_schema") or {})
175175
}
176176

177-
if tool.get("description"):
178-
kwags["description"] = tool.get("description")
177+
description = tool.get("description")
178+
if description is not None:
179+
kwags["description"] = cast(Union[dict, str], description)
179180

180181
return DatabricksTool(
181182
type="function",
@@ -336,8 +337,8 @@ def extract_content_str(
336337
elif isinstance(content, list):
337338
content_str = ""
338339
for item in content:
339-
if item["type"] == "text":
340-
content_str += item["text"]
340+
if item.get("type") == "text":
341+
content_str += item.get("text", "")
341342
return content_str
342343
else:
343344
raise Exception(f"Unsupported content type: {type(content)}")
@@ -366,8 +367,9 @@ def extract_reasoning_content(
366367
reasoning_content: Optional[str] = None
367368
if isinstance(content, list):
368369
for item in content:
369-
if item["type"] == "reasoning":
370-
for sum in item["summary"]:
370+
if item.get("type") == "reasoning":
371+
summary_list = item.get("summary", [])
372+
for sum in summary_list:
371373
if reasoning_content is None:
372374
reasoning_content = ""
373375
reasoning_content += sum["text"]

0 commit comments

Comments
 (0)