fix(llm): correct type annotation from lowercase callable to Callable

Fixes #599

The `callable` keyword in Python is a builtin function to check if something
is callable, NOT a type annotation. For type hints, we need `Callable` from
the typing module.

Changed:
- `tool_executor: callable` → `tool_executor: Callable[[ToolUse], ToolResult]`

Files updated:
- core/framework/llm/provider.py
- core/framework/llm/anthropic.py
- core/framework/llm/litellm.py

This fixes mypy/pyright type checking errors like:
"Variable annotation syntax is for types; callable is a function"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Kira714
2026-01-26 16:27:54 +08:00
parent 02330653ee
commit 1c78174aaf
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
"""Anthropic Claude LLM provider - backward compatible wrapper around LiteLLM."""
import os
from typing import Any
from typing import Any, Callable
from framework.llm.provider import LLMProvider, LLMResponse, Tool
from framework.llm.provider import LLMProvider, LLMResponse, Tool, ToolUse, ToolResult
from framework.llm.litellm import LiteLLMProvider
@@ -85,7 +85,7 @@ class AnthropicProvider(LLMProvider):
messages: list[dict[str, Any]],
system: str,
tools: list[Tool],
tool_executor: callable,
tool_executor: Callable[[ToolUse], ToolResult],
max_iterations: int = 10,
) -> LLMResponse:
"""Run a tool-use loop until Claude produces a final response (via LiteLLM)."""