Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/crewai-files/src/crewai_files/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class BaseFile(ABC, BaseModel):
- File source management
- Content reading
- Dict unpacking support (`**` syntax)
- Per-file mode mode
- Per-file mode

Can be unpacked with ** syntax: `{**ImageFile(source="./chart.png")}`
which unpacks to: `{"chart": <ImageFile instance>}` using filename stem as key.
Expand Down
10 changes: 5 additions & 5 deletions lib/crewai-files/src/crewai_files/processing/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@


class FileProcessor:
"""Processes files according to provider constraints and per-file mode mode.
"""Processes files according to provider constraints and per-file mode.

Validates files against provider-specific limits and optionally transforms
them (resize, compress, chunk) to meet those limits. Each file specifies
its own mode mode via `file.mode`.
its own mode via `file.mode`.

Attributes:
constraints: Provider constraints for validation.
Expand Down Expand Up @@ -90,13 +90,13 @@ def validate(self, file: FileInput) -> Sequence[str]:

@staticmethod
def _get_mode(file: FileInput) -> FileHandling:
"""Get the mode mode for a file.
"""Get the mode for a file.

Args:
file: The file to get mode for.

Returns:
The file's mode mode, defaulting to AUTO.
The file's mode, defaulting to AUTO.
"""
mode = getattr(file, "mode", None)
if mode is None:
Expand All @@ -108,7 +108,7 @@ def _get_mode(file: FileInput) -> FileHandling:
return FileHandling.AUTO

def process(self, file: FileInput) -> FileInput | Sequence[FileInput]:
"""Process a single file according to constraints and its mode mode.
"""Process a single file according to constraints and its mode.

Args:
file: The file to process.
Expand Down
4 changes: 2 additions & 2 deletions lib/crewai/tests/utilities/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,13 @@ def test_file_default_mode(self) -> None:
assert f.mode == "auto"

def test_file_custom_mode(self) -> None:
"""Test File with custom mode mode."""
"""Test File with custom mode."""
f = File(source=b"content", mode="strict")

assert f.mode == "strict"

def test_file_chunk_mode(self) -> None:
"""Test File with chunk mode mode."""
"""Test File with chunk mode."""
f = File(source=b"content", mode="chunk")

assert f.mode == "chunk"
Expand Down