Gemini gemini-1.5-flash-latest doesn't work when setting maxItems in JSON schema output

Hi all. Just reporting an issue. I am trying to extract data sources from a document, and sometimes there are a lot! So many, that the JSON that gemini creates is poorly formatted.

So I want to limit the number of items that are output in the JSON, but when I read the Vertex AI schema reference which says to add “maxItems”, I just get a 500 response and the API request fails.

I added maxItems to my Generation Config below, but no matter what I do, it doesn’t work, and Gemini doesn’t limit the number of json objects even if I give it in the prompt.

Any ideas? I wish this worked.

Also what’s up with Gemini’s JSON formatting ability? It seems to just cut things off and not properly output very long JSON outputs…

Thanks

"generationConfig": {
    "temperature": 1,
    "topK": 64,
    "topP": 0.95,
    "maxOutputTokens": 8192,
    "responseMimeType": "application/json",
    "responseSchema": {
      "type": "object",
      "properties": {
        "data_sources": {
          "type": "array",
          "description": "List of data sources and data related sources identified in the document. Limit to a max of 30 items.",
          "maxItems": 30,
          "items": {
            "type": "object",
            "properties": {
              "data_source_title": {
                "type": "string",
                "description": "State the name of the data source"
              },...```