2023-06-24 OpenAI in Squidex CLI

I am evaluating at the moment how to use OpenAI and AI in general. Unfortunately I have no detailed understanding about machine learning, but this does not stop me to leverage them.

In the first iteration I integrated an command in the CLI to generate schemas and contents using OpenAI.

How to apply

Starting with v11.0.0 you can use the following command:

ai generate-contents "The ten biggest countries with name, iso2code and area" -k "YOUR KEY"

This will provide a overview of the schema and contents:

Schema Name: ten-biggest-countries

Schema Fields:
 | Name     | Type   |
 | name     | string |
 | iso2code | string |
 | area     | number |

 Count: 3

 | name          | iso2code | area     |
 | Russia        | RU       | 17124442 |
 | Canada        | CA       | 9984670  |
 | China         | CN       | 9631411  |
 | United States | US       | 9363520  |
 | Brazil        | BR       | 8515767  |
 | Australia     | AU       | 7692024  |
 | India         | IN       | 3287263  |
 | Argentina     | AR       | 2780400  |
 | Kazakhstan    | KZ       | 2724900  |
 | Algeria       | DZ       | 2381741  |

 Count: 10

Especially the schema name is not ideal in most cases, but you can override it:

ai generate-contents "The ten biggest countries with name, iso2code and area" -k "YOUR KEY" --schema countries

In general any help is welcome, because It makes a big difference how you write the messages and I am no expert in that.

If you want to apply then add the --execute flag:

ai generate-contents "The ten biggest countries with name, iso2code and area" -k "YOUR KEY" --schema countries --execute

Other ideas

I have a few other ideas:


Generating schemas and content is really useful.

Having a CLI tool for that is great but what would be even greater is to have a UI in Squidex Admin UI where you could by following a wizard and answering a few simple questions about how you would like your schema to look like and then letting it generate some content for you.

The other days I was doing some research looking for a good library for generating random content based on a schema with realistic values. I came across https://fakerjs.dev/ and https://chancejs.com/. They seem pretty decent at what they’re designed to do. Maybe one could do a combo of using one of these libraries together with OpenAI. Or at least use them for inspiration.

Yes, I have to figure out how to handle these stuff in the UI. It is just os much work. Writing a good web UI takes 10x more time than writing a CLI interface. At least

Yep. That’s true.
Maybe you could do something rough and content creators could enable the experimental feature with a feature flag in the admin UI somewhere.

But tbh i don’t know how useful that would really be. I mean there are some valid use cases but still.

Ok. Need to share this before I forget.

I was checking out some videos about headless CMSs and this idea popped up.

What if as a content editor could use chatgpt or its APIs with a GUI on top of it for translating my blog posts?

This feature would be gold IMO. I would definitely use it in my own multilingual websites/webapps.

That’s it for now. I haven’t had time to think through it more than that but I definitely see this feature inside modern CMSs including Squidex in the future.

I am not sure if OpenAI is the best for translating. But there is already a UI to generate content with ChatGPT in Squidex. And with the new editor we could think about an even deeper integration, so that you asks questions directly in the content editor.

Cool. Will have to test those features out.