Problems in the use of dell-e's response_format and prompt parameters

In the image generation document given by openai, I saw that the response_format parameter can generate the format of b64_json or url when controlling the production of images, but there seems to be no difference when I try it. Am I using the wrong one?

# Using python language.
response = openai.Image.create(
        prompt=prompt,
        n=2,
        size="1024x1024",
        response_format='b64_json'
    )

Official website said that prompt has a maximum of 1000 characters. Is there any interface or way to convert it? For example, how many characters are Chinese characters equal to, and one sentence in Chinese is multiple characters?

What do you mean by this? url will send the URL back and b64 will send image data…

1 Like

My B64 still returns a URL, but I use the service provided by Microsoft, which may not be supported by Microsoft.

Specify API version as: 2023-08-01-preview

The schema seems to have the option in the response_format definition:

"ImageGenerationOptions": {
  "type": "object",
  "description": "Represents the request data used to generate images.",
  "properties": {
    "prompt": {
      "type": "string",
      "description": "A description of the desired images."
    },
    "n": {
      "type": "integer",
      "format": "int32",
      "description": "The number of images to generate (defaults to 1).",
      "default": 1
    },
    "size": {
      "$ref": "#/definitions/ImageSize",
      "description": "The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 (defaults to 1024x1024).",
      "default": "1024x1024"
    },
    "response_format": {
      "$ref": "#/definitions/ImageGenerationResponseFormat",
      "description": "  The format in which image generation response items should be presented.\n  Azure OpenAI only supports URL response items.",
      "x-ms-client-name": "responseFormat"
    },
    "user": {
      "type": "string",
      "description": "A unique identifier representing your end-user, which can help to monitor and detect abuse."
    }
  },
  "required": [
    "prompt"
  ]
},
"ImageGenerationResponseFormat": {
  "type": "string",
  "description": "The format in which the generated images are returned.",
  "enum": [
    "url",
    "b64_json"
  ],
  "x-ms-enum": {
    "name": "ImageGenerationResponseFormat",
    "modelAsString": true,
    "values": [
      {
        "name": "Url",
        "value": "url",
        "description": "Image generation response items should provide a URL from which the image may be retrieved."
      },
      {
        "name": "Base64",
        "value": "b64_json",
        "description": "Image generation response items should provide image data as a base64-encoded string."
      }
    ]
  }
},

Chinese characters may be counted as two bytes (or more). You can just send and see when your request is rejected.

It still doesn’t work. I use openai.api _ version = "2023-08-01-preview" or the produced bs64 and url all return a url.

on OpenAI:
requesting n=1 or n=2 @ 256 or even n=2 @ 1024 :

"data": [
    {
      "b64_json": "iVBORw0KGgoAAA

Or 84000 lines of console when I print the last case.
So it’s an Azure problem. You can bug report to them.

Can you show me your parameter configuration? I asked Microsoft for a response and it seems that it is not supported for the time being.

response = openai.Image.create(
        prompt="a kitty begging at its bowl for food",
        n=2,
        size="1024x1024",
        response_format='b64_json'
    )
print(response)

(don’t actually “print response” unless you have a print accelerator to deal with megabytes.

Python 3.8.16. Latest openai 0.28.0.