feat: add prompt caching support for Anthropic

This commit is contained in:
Greyson LaLonde
2026-01-21 18:46:06 -05:00
parent 3ad0af4934
commit 8cf0cfa2b7
8 changed files with 16 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ import logging
from crewai.utilities.files.content_types import (
AudioFile,
File,
ImageFile,
PDFFile,
TextFile,
@@ -34,7 +35,7 @@ from crewai.utilities.files.processing.validators import validate_file
logger = logging.getLogger(__name__)
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
class FileProcessor:

View File

@@ -5,6 +5,7 @@ import logging
from crewai.utilities.files.content_types import (
AudioFile,
File,
ImageFile,
PDFFile,
TextFile,
@@ -26,7 +27,7 @@ from crewai.utilities.files.processing.exceptions import (
logger = logging.getLogger(__name__)
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
def _format_size(size_bytes: int) -> str:

View File

@@ -6,6 +6,7 @@ import logging
from crewai.utilities.files.content_types import (
AudioFile,
File,
ImageFile,
PDFFile,
TextFile,
@@ -28,7 +29,7 @@ from crewai.utilities.files.uploaders.base import FileUploader
logger = logging.getLogger(__name__)
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
@dataclass

View File

@@ -8,6 +8,7 @@ import threading
from crewai.utilities.files.content_types import (
AudioFile,
File,
ImageFile,
PDFFile,
TextFile,
@@ -17,7 +18,7 @@ from crewai.utilities.files.content_types import (
logger = logging.getLogger(__name__)
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
@dataclass

View File

@@ -9,6 +9,7 @@ from typing import Any
from crewai.utilities.files.content_types import (
AudioFile,
File,
ImageFile,
PDFFile,
TextFile,
@@ -19,7 +20,7 @@ from crewai.utilities.files.uploaders.base import FileUploader, UploadResult
logger = logging.getLogger(__name__)
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
class AnthropicFileUploader(FileUploader):

View File

@@ -7,6 +7,7 @@ from typing import Any
from crewai.utilities.files.content_types import (
AudioFile,
File,
ImageFile,
PDFFile,
TextFile,
@@ -14,7 +15,7 @@ from crewai.utilities.files.content_types import (
)
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
@dataclass

View File

@@ -10,6 +10,7 @@ from typing import Any
from crewai.utilities.files.content_types import (
AudioFile,
File,
ImageFile,
PDFFile,
TextFile,
@@ -20,7 +21,7 @@ from crewai.utilities.files.uploaders.base import FileUploader, UploadResult
logger = logging.getLogger(__name__)
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
# Gemini files expire after 48 hours
GEMINI_FILE_TTL = timedelta(hours=48)

View File

@@ -9,6 +9,7 @@ from typing import Any
from crewai.utilities.files.content_types import (
AudioFile,
File,
ImageFile,
PDFFile,
TextFile,
@@ -19,7 +20,7 @@ from crewai.utilities.files.uploaders.base import FileUploader, UploadResult
logger = logging.getLogger(__name__)
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
class OpenAIFileUploader(FileUploader):