Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-85352

Add support for b64_json to the generate_image action

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.5.5, 5.0.1, 5.1
    • AI
    • MOODLE_405_STABLE, MOODLE_500_STABLE, MOODLE_501_STABLE

      Some OpenAI models (dall-e ones, mainly) historically have allowed, via the response_format param to decide if the resulting image should be provided via URL or base64 encoded in the response.

      It seems that Moodle's OpenAI generate_image action only supports the former (url) and is missing any implementation for the later (b64_json).

      Newer models (Gemini imagen-3.x, OpenAI gpt-image-1, ...) are ceasing support for the "url" value and only implementing the "b64_json" one. More yet, they are dropping support for response_format completely and always provide the response in b64.

      Also, note that the "url" alternative has some privacy concerns as far as the resulting images are stored into public temporal storage. In the other side, the b64 format doesn't present those concerns.

      So, this issue is about to add support to the b64_json format, which handling is really simple (just read the data/b64_json element in the response, base64-decode it and that's the file).

      Also, as commented in MDL-83147, at some point we should make Moodle aware about the differences between different models, because they are introducing more incompatibilities between them (same provider). Right now, some parameters are being assumed (dall-e-3 ones, mainly) and they don't work with other models (both of the same OpenAI provider but also of other providers with an OpenAI compatible layer).

      Ciao

      PS: While this is a new feature, it really impacts Moodle 4.5 and 5.0 (unable to use those new models), so surely it should be considered to be backported. For me it looks like it's a well-isolated, aka, safe feature to backport. Over the paper at very least, it is, for me.

            Unassigned Unassigned
            stronk7 Eloy Lafuente (stronk7)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.