Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

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

Greyson LaLondecb7cd12d4eef
diff --git a/.github/workflows/type-checker.yml b/.github/workflows/type-checker.yml
index e56214d89..3dd77187f 100644
--- a/.github/workflows/type-checker.yml
+++ b/.github/workflows/type-checker.yml
@@ -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'
diff --git a/lib/crewai-files/src/crewai_files/formatting/api.py b/lib/crewai-files/src/crewai_files/formatting/api.py
index 3c362315e..1d846b18a 100644
--- a/lib/crewai-files/src/crewai_files/formatting/api.py
+++ b/lib/crewai-files/src/crewai_files/formatting/api.py
@@ -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"
diff --git a/lib/crewai-files/src/crewai_files/processing/constraints.py b/lib/crewai-files/src/crewai_files/processing/constraints.py
index fe11fe9b3..ba05827d5 100644
--- a/lib/crewai-files/src/crewai_files/processing/constraints.py
+++ b/lib/crewai-files/src/crewai_files/processing/constraints.py
@@ -15,6 +15,7 @@ from crewai_files.core.types import (
ProviderName = Literal[
"anthropic",
"openai",
+ "openai_responses",
"gemini",
"bedrock",
"azure",
diff --git a/lib/crewai-files/src/crewai_files/processing/transformers.py b/lib/crewai-files/src/crewai_files/processing/transformers.py
index a51f13c92..dc89ad015 100644
--- a/lib/crewai-files/src/crewai_files/processing/transformers.py
+++ b/lib/crewai-files/src/crewai_files/processing/transformers.py
@@ -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"
diff --git a/lib/crewai-files/src/crewai_files/processing/validators.py b/lib/crewai-files/src/crewai_files/processing/validators.py
index 9f2c94e92..7710e36d5 100644
--- a/lib/crewai-files/src/crewai_files/processing/validators.py
+++ b/lib/crewai-files/src/crewai_files/processing/validators.py
@@ -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. "