mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 07:13:00 +00:00
fix: resolve mypy errors in crewai-files and add all packages to CI type checks
This commit is contained in:
2
.github/workflows/type-checker.yml
vendored
2
.github/workflows/type-checker.yml
vendored
@@ -41,7 +41,7 @@ jobs:
|
|||||||
run: uv sync --all-groups --all-extras
|
run: uv sync --all-groups --all-extras
|
||||||
|
|
||||||
- name: Run type checks
|
- 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
|
- name: Save uv caches
|
||||||
if: steps.cache-restore.outputs.cache-hit != 'true'
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ def format_multimodal_content(
|
|||||||
return content_blocks
|
return content_blocks
|
||||||
|
|
||||||
# Use API-specific constraints for OpenAI
|
# Use API-specific constraints for OpenAI
|
||||||
constraints_key = provider_type
|
constraints_key: str = provider_type
|
||||||
if api == "responses" and "openai" in provider_type.lower():
|
if api == "responses" and "openai" in provider_type.lower():
|
||||||
constraints_key = "openai_responses"
|
constraints_key = "openai_responses"
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ async def aformat_multimodal_content(
|
|||||||
return content_blocks
|
return content_blocks
|
||||||
|
|
||||||
# Use API-specific constraints for OpenAI
|
# Use API-specific constraints for OpenAI
|
||||||
constraints_key = provider_type
|
constraints_key: str = provider_type
|
||||||
if api == "responses" and "openai" in provider_type.lower():
|
if api == "responses" and "openai" in provider_type.lower():
|
||||||
constraints_key = "openai_responses"
|
constraints_key = "openai_responses"
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from crewai_files.core.types import (
|
|||||||
ProviderName = Literal[
|
ProviderName = Literal[
|
||||||
"anthropic",
|
"anthropic",
|
||||||
"openai",
|
"openai",
|
||||||
|
"openai_responses",
|
||||||
"gemini",
|
"gemini",
|
||||||
"bedrock",
|
"bedrock",
|
||||||
"azure",
|
"azure",
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ def optimize_image(
|
|||||||
|
|
||||||
with Image.open(io.BytesIO(content)) as img:
|
with Image.open(io.BytesIO(content)) as img:
|
||||||
if img.mode in ("RGBA", "LA", "P"):
|
if img.mode in ("RGBA", "LA", "P"):
|
||||||
img = img.convert("RGB")
|
img = img.convert("RGB") # type: ignore[assignment]
|
||||||
output_format = "JPEG"
|
output_format = "JPEG"
|
||||||
else:
|
else:
|
||||||
output_format = img.format or "JPEG"
|
output_format = img.format or "JPEG"
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ def _get_audio_duration(content: bytes, filename: str | None = None) -> float |
|
|||||||
Duration in seconds or None if tinytag unavailable.
|
Duration in seconds or None if tinytag unavailable.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from tinytag import TinyTag # type: ignore[import-untyped]
|
from tinytag import TinyTag
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"tinytag not installed - cannot validate audio duration. "
|
"tinytag not installed - cannot validate audio duration. "
|
||||||
|
|||||||
Reference in New Issue
Block a user