Is an automation like this possible with Discourse AI today?

There’s is a task we do today that I’ve been able to make pretty good progress in automating using n8n, but I’m wondering if it’s possible with Discourse natively.

We have a draft category where product marketing managers draft product announcements to be sent out about their products. When they create that draft, we look at the product name, the version, if it’s a major/minor/patch release. We also take the body of their announcement content and summarize it with a LLM for a 4-7 word description of the content.

We then use that to create the announcement banner in Adobe, like so:

I feel as though this could be done by an LLM and some traditional logic:

  • The background is just one hue per announcement type and there are four variations of each color—we just randomly select one.
  • The product name and version are entered into the boxes at the top
  • The description in the body middle-center there
  • We use https://storyset.com/ to whip up a quick illustration to put on the right.

I feel I have a good approach to doing this with n8n, but wonder if it could be done natively with Discourse AI and other tools?

2 Likes

The Designer persona using the excellent new GPT Image 1 model is capable of doing stuff like this:

I think you could wire something up using custom presona and using the right tools to achieve a lot of this, for sure.

3 Likes

Note for custom tool usage, as long as there are proper REST APIs you can integrate easily, for example this is how I integrate with flux image generation:

const apiKey = "password";
const model = "black-forest-labs/FLUX.1.1-pro";

let prompt;

function invoke(params) {
  let seed = parseInt(params.seed);
  if (!(seed > 0)) {
    seed = Math.floor(Math.random() * 1000000) + 1;
  }

  let height = parseInt(params.height);
  if (!height || height < 256 || height > 1440) {
      height = 768;
  }
  let width = parseInt(params.width);
  if (!width || width < 256 || width > 1440) {
      width = 1024;
  }
  
  width = width - (width % 32);
  height = height - (height %32);

  prompt = params.prompt;
  const negative_prompt = params.negative_prompt || "";
  const body = {
    model: model,
    prompt: prompt,
    width: width,
    height: height,
    steps: 10,
    n: 1,
    seed: seed,
    negative_prompt: negative_prompt,
    response_format: "b64_json",
  };

  const result = http.post("https://api.together.xyz/v1/images/generations", {
    headers: {
      "Authorization": `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(body),
  });
  
  if (result.status !== 200) {
      return { error: true, body: result.body };
  }

  const base64Image = JSON.parse(result.body).data[0].b64_json;
  const image = upload.create("generated_image.png", base64Image);
  const raw = `
![${prompt}](${image.short_url})
`;
  
  if (!params.show_to_user === false) {
     chain.setCustomRaw(raw);
  }

  return { result: "Image generated successfully", prompt: prompt, url: image.url, seed: seed, negative_prompt: negative_prompt };
}

function details() {
  return prompt;
}

You can see the HTTP post and the parsing of the base 64 image in the sample.

4 Likes

If given a post body, does the burden for turning content from that body into valid parameters fall on Discourse AI to read the content and then create the request object? Or should the raw content be passed onto the tool and the burden for an LLM parsing that for the necessary data to construct a proper input for its API call exist there?

1 Like

Yes in that case the tool has an api already for reading posts so you can just pass an id in

2 Likes

Would you be able to point me to the docs for this by chance?