diff --git a/src/mistral_common/multimodal.py b/src/mistral_common/multimodal.py index a167a77..7829612 100644 --- a/src/mistral_common/multimodal.py +++ b/src/mistral_common/multimodal.py @@ -7,11 +7,13 @@ from pydantic import BeforeValidator, PlainSerializer, SerializationInfo from typing_extensions import Annotated +from mistral_common import __version__ def download_image(url: str) -> Image.Image: + headers = {"User-Agent": f"mistral-common/{__version__}"} try: # Make a request to download the image - response = requests.get(url) + response = requests.get(url, headers=headers) response.raise_for_status() # Raise an error for bad responses (4xx, 5xx) # Convert the image content to a PIL Image