src/psearch/gen_ai/services/enrichiment_service.py [229:252]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        parts = [types.Part.from_text(text=user_prompt)]

        # Try to get the product image and include it in the prompt
        try:
            if product_data.get("images") and len(product_data["images"]) > 0:
                image_url = product_data["images"][0].get("uri")
                if image_url:
                    image_bytes = self._get_image_bytes_from_url(image_url)
                    if image_bytes:
                        # Determine MIME type based on file extension
                        if image_url.lower().endswith(".png"):
                            mime_type = "image/png"
                        elif image_url.lower().endswith((".jpg", ".jpeg")):
                            mime_type = "image/jpeg"
                        elif image_url.lower().endswith(".gif"):
                            mime_type = "image/gif"
                        else:
                            mime_type = "image/jpeg"  # Default to JPEG

                        # Add image part to the prompt
                        image_part = types.Part.from_bytes(
                            data=image_bytes, mime_type=mime_type
                        )
                        parts.append(image_part)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/psearch/gen_ai/services/marketing_service.py [217:240]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        parts = [types.Part.from_text(text=user_prompt)]

        # Try to get the product image and include it in the prompt
        try:
            if product_data.get("images") and len(product_data["images"]) > 0:
                image_url = product_data["images"][0].get("uri")
                if image_url:
                    image_bytes = self._get_image_bytes_from_url(image_url)
                    if image_bytes:
                        # Determine MIME type based on file extension
                        if image_url.lower().endswith(".png"):
                            mime_type = "image/png"
                        elif image_url.lower().endswith((".jpg", ".jpeg")):
                            mime_type = "image/jpeg"
                        elif image_url.lower().endswith(".gif"):
                            mime_type = "image/gif"
                        else:
                            mime_type = "image/jpeg"  # Default to JPEG

                        # Add image part to the prompt
                        image_part = types.Part.from_bytes(
                            data=image_bytes, mime_type=mime_type
                        )
                        parts.append(image_part)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



