mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-26 16:48:13 +00:00
feat: add prompt caching support for Anthropic
This commit is contained in:
@@ -5,6 +5,7 @@ import logging
|
|||||||
|
|
||||||
from crewai.utilities.files.content_types import (
|
from crewai.utilities.files.content_types import (
|
||||||
AudioFile,
|
AudioFile,
|
||||||
|
File,
|
||||||
ImageFile,
|
ImageFile,
|
||||||
PDFFile,
|
PDFFile,
|
||||||
TextFile,
|
TextFile,
|
||||||
@@ -34,7 +35,7 @@ from crewai.utilities.files.processing.validators import validate_file
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
|
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
|
||||||
|
|
||||||
|
|
||||||
class FileProcessor:
|
class FileProcessor:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import logging
|
|||||||
|
|
||||||
from crewai.utilities.files.content_types import (
|
from crewai.utilities.files.content_types import (
|
||||||
AudioFile,
|
AudioFile,
|
||||||
|
File,
|
||||||
ImageFile,
|
ImageFile,
|
||||||
PDFFile,
|
PDFFile,
|
||||||
TextFile,
|
TextFile,
|
||||||
@@ -26,7 +27,7 @@ from crewai.utilities.files.processing.exceptions import (
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
|
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
|
||||||
|
|
||||||
|
|
||||||
def _format_size(size_bytes: int) -> str:
|
def _format_size(size_bytes: int) -> str:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import logging
|
|||||||
|
|
||||||
from crewai.utilities.files.content_types import (
|
from crewai.utilities.files.content_types import (
|
||||||
AudioFile,
|
AudioFile,
|
||||||
|
File,
|
||||||
ImageFile,
|
ImageFile,
|
||||||
PDFFile,
|
PDFFile,
|
||||||
TextFile,
|
TextFile,
|
||||||
@@ -28,7 +29,7 @@ from crewai.utilities.files.uploaders.base import FileUploader
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
|
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import threading
|
|||||||
|
|
||||||
from crewai.utilities.files.content_types import (
|
from crewai.utilities.files.content_types import (
|
||||||
AudioFile,
|
AudioFile,
|
||||||
|
File,
|
||||||
ImageFile,
|
ImageFile,
|
||||||
PDFFile,
|
PDFFile,
|
||||||
TextFile,
|
TextFile,
|
||||||
@@ -17,7 +18,7 @@ from crewai.utilities.files.content_types import (
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
|
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from typing import Any
|
|||||||
|
|
||||||
from crewai.utilities.files.content_types import (
|
from crewai.utilities.files.content_types import (
|
||||||
AudioFile,
|
AudioFile,
|
||||||
|
File,
|
||||||
ImageFile,
|
ImageFile,
|
||||||
PDFFile,
|
PDFFile,
|
||||||
TextFile,
|
TextFile,
|
||||||
@@ -19,7 +20,7 @@ from crewai.utilities.files.uploaders.base import FileUploader, UploadResult
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
|
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
|
||||||
|
|
||||||
|
|
||||||
class AnthropicFileUploader(FileUploader):
|
class AnthropicFileUploader(FileUploader):
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from typing import Any
|
|||||||
|
|
||||||
from crewai.utilities.files.content_types import (
|
from crewai.utilities.files.content_types import (
|
||||||
AudioFile,
|
AudioFile,
|
||||||
|
File,
|
||||||
ImageFile,
|
ImageFile,
|
||||||
PDFFile,
|
PDFFile,
|
||||||
TextFile,
|
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
|
@dataclass
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from typing import Any
|
|||||||
|
|
||||||
from crewai.utilities.files.content_types import (
|
from crewai.utilities.files.content_types import (
|
||||||
AudioFile,
|
AudioFile,
|
||||||
|
File,
|
||||||
ImageFile,
|
ImageFile,
|
||||||
PDFFile,
|
PDFFile,
|
||||||
TextFile,
|
TextFile,
|
||||||
@@ -20,7 +21,7 @@ from crewai.utilities.files.uploaders.base import FileUploader, UploadResult
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
|
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
|
||||||
|
|
||||||
# Gemini files expire after 48 hours
|
# Gemini files expire after 48 hours
|
||||||
GEMINI_FILE_TTL = timedelta(hours=48)
|
GEMINI_FILE_TTL = timedelta(hours=48)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from typing import Any
|
|||||||
|
|
||||||
from crewai.utilities.files.content_types import (
|
from crewai.utilities.files.content_types import (
|
||||||
AudioFile,
|
AudioFile,
|
||||||
|
File,
|
||||||
ImageFile,
|
ImageFile,
|
||||||
PDFFile,
|
PDFFile,
|
||||||
TextFile,
|
TextFile,
|
||||||
@@ -19,7 +20,7 @@ from crewai.utilities.files.uploaders.base import FileUploader, UploadResult
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
FileInput = AudioFile | ImageFile | PDFFile | TextFile | VideoFile
|
FileInput = AudioFile | File | ImageFile | PDFFile | TextFile | VideoFile
|
||||||
|
|
||||||
|
|
||||||
class OpenAIFileUploader(FileUploader):
|
class OpenAIFileUploader(FileUploader):
|
||||||
|
|||||||
Reference in New Issue
Block a user