DEV Community

Cover image for Sorting NFT Art with MakerSuite and PALM API
Denis Valášek
Denis Valášek

Posted on • Edited on

Sorting NFT Art with MakerSuite and PALM API

At rc.xyz we sort out hundereds of thousands of NFT Artworks so the artists have nice and clean portfolios of their work. However, sometimes it's hard to convert the logic into the code, so let's use the help of Google MakerSuite and PALM API!

We won't dive deep into what MakerSuite or PALM is, if you are interested, please watch the linked introduction videos!

Getting started

MakerSuite intro screen

MakerSuite offers several ways for interacting with the API, for our use-case, we will use the Data prompt, since it gives us a UI to create a prompt with few examples more easily.

First version of our prompt:

You are a category classifier, your job is to decide whether the items match together and if so, generate suitable category name. You output JSON with value valid: boolean and optionally name: string if valid is true.

We are using few tricks to make our prompt perform better:

  • Giving the LLM instructions about what it is supposed to do
  • Describing desired output structure (JSON with types like string and boolean)
  • Describing what choices it should made

Examples:

Examples text is provided in the prompt link at the end

Tip: You can import/export examples right from the MakerSuite, under the Actions button

MakerSuite action button

Testing

MakerSuite enables us to test our prompt with multiple test fields at once, so we don't have to call the API again and again, let's try it out with some cases we have not used in the testing data.

Test cases

And after running the prompt:

Finished generation

Which is in line with what we expect, great!

Implementation

MakerSuite offers you to export the code snippet right from the web UI, which includes the full formatted prompt along will the other model settings.

Code export

While the JS snippet suggest installing helper packages, it's still fully possible to use just fetch with the API key, since there isn't any complicated auth process as with most of the Google APIs. Thanks to minimal dependencies, it can run anywhere in your backend, like in Firebase Cloud Functions.

As with any Generative AI stuff, we highly recommend adding human in the loop to verify that the results are valid and revert them if not.

You can view the full prompt thanks to MakerSuite sharing here.

Top comments (0)