Summarize Topic with AI loads indefinitely, Invalid JSON Payload Received?

Hello, recently I have noticed that the Topic summary function on my forum has seemingly stopped working entirely, with requests to generate a topic summary hanging indefenitely. It is notable that the other AI tools on the site are working properly such as Summarization Gists and AI Composer Helper.

Below is an image of the Topic summary modal seemingly hanging:

Here is a log entry that appears to be related:

DiscourseAi::Completions::Endpoints::Gemini: status: 400 - body: {
  "error": {
    "code": 400,
    "message": "Invalid value at 'generation_config.response_schema.type' (type.googleapis.com/google.ai.generativelanguage.v1beta.Type), \"json_schema\"\nInvalid JSON payload received. Unknown name \"json_schema\" at 'generation_config.response_schema': Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "generation_config.response_schema.type",
            "description": "Invalid value at 'generation_config.response_schema.type' (type.googleapis.com/google.ai.generativelanguage.v1beta.Type), \"json_schema\""
          },
          {
            "field": "generation_config.response_schema",
            "description": "Invalid JSON payload received. Unknown name \"json_schema\" at 'generation_config.response_schema': Cannot find field."
          }
        ]
      }
    ]
  }
}

Has anyone else encountered this issue or have an idea on how to resolve this? Thanks in advance.

What model are you using?

1 Like

I am currently using Gemini 2.0 Flash, free tier.

1 Like

Can you try setting provider to “OpenAI” and the endpoint to https://generativelanguage.googleapis.com/v1beta/chat/completions ?

1 Like

I have done the steps you gave and I can confirm the LLM is now working as expected. Thanks!

1 Like

Very happy it is sorted, but I still think there is a bug here we should sort out @Falco / @Roman_Rizzi

Stuff should maybe fallback if for any reason a model says it will return JSON but does not. This is one area we should eval.

1 Like

Oh definitely, I wanted to help isolate it to the Google API instead of the model so we can work on a fix this week.

2 Likes