fix: resolve mypy errors in crewai-files and add all packages to CI type checks

This commit is contained in:
Greyson LaLonde
2026-03-25 13:44:57 +08:00
committed by GitHub
parent d955203e55
commit cb7cd12d4e
5 changed files with 6 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ jobs:
run: uv sync --all-groups --all-extras
- name: Run type checks
run: uv run mypy lib/crewai/src/crewai/ lib/crewai-tools/src/crewai_tools/
run: uv run mypy lib/
- name: Save uv caches
if: steps.cache-restore.outputs.cache-hit != 'true'

View File

@@ -122,7 +122,7 @@ def format_multimodal_content(
return content_blocks
# Use API-specific constraints for OpenAI
constraints_key = provider_type
constraints_key: str = provider_type
if api == "responses" and "openai" in provider_type.lower():
constraints_key = "openai_responses"
@@ -187,7 +187,7 @@ async def aformat_multimodal_content(
return content_blocks
# Use API-specific constraints for OpenAI
constraints_key = provider_type
constraints_key: str = provider_type
if api == "responses" and "openai" in provider_type.lower():
constraints_key = "openai_responses"

View File

@@ -15,6 +15,7 @@ from crewai_files.core.types import (
ProviderName = Literal[
"anthropic",
"openai",
"openai_responses",
"gemini",
"bedrock",
"azure",

View File

@@ -120,7 +120,7 @@ def optimize_image(
with Image.open(io.BytesIO(content)) as img:
if img.mode in ("RGBA", "LA", "P"):
img = img.convert("RGB")
img = img.convert("RGB") # type: ignore[assignment]
output_format = "JPEG"
else:
output_format = img.format or "JPEG"

View File

@@ -85,7 +85,7 @@ def _get_audio_duration(content: bytes, filename: str | None = None) -> float |
Duration in seconds or None if tinytag unavailable.
"""
try:
from tinytag import TinyTag # type: ignore[import-untyped]
from tinytag import TinyTag
except ImportError:
logger.warning(
"tinytag not installed - cannot validate audio duration. "