AI fields are great, but limited

I have been working with the AI fields for a while now. Really great feature by the way :slightly_smiling_face:

I think the “Generate” button is good for giving the user control over token and therefore money usage.

On the other hand this feels kind of limiting. One of the greatest strengths of Baserow is the API and the possibility to automate almost everything. At the moment there is no way to do that (as far as I know). Of course you could achieve that with external tools like n8n, but I think this workaround should not be necessary.

Therefore I think it should be possible to trigger the (re)generation of the AI prompt over the API

In the context of the Application Builder it would also be nice to have the possibility to trigger the AI prompt generation.

Hi @m3tam3re, welcome to the forum!

It is a great idea and something the team will be looking at soon enough. For now, I have added your comment to an existing GitLab issue that is related to the generation of AI prompts in batch.

1 Like

Hi @m3tam3re,

Therefore I think it should be possible to trigger the (re)generation of the AI prompt over the API

Generating AI-based values for cells one by one is possible through this endpoint: generate_table_ai_field_value. We are indeed missing a batch option as @cwinhall pointed out.

Thank for the hint :blush:

Hi @petrs . Quick question. Is this API request available for self-hosted? I have a premium license, but can’t seem to make this work.

This also works on your self hosted instance :slightly_smiling_face:

I think the API docs are not explaining this well. To use this you will need to use a JWT token and not a database token as usual.

  1. You will need to get a JWT token:
curl --request POST \
  --url https://your.baserowinstance.com/api/user/token-auth/ \
  --header 'Content-Type: application/json' \
  --data '{
"username": "user@youremail.com",
"password": "yoursupersectretpassword"
}'
  1. Make the request to generate the AI fields:
    In this request you will need to have your {field_id} (just the number) in the URL and for the Authorization you will need to add JWT {access_token} (the token obtained in the previous request.
curl --request POST \
  --url https://br.m3tam3re.com/api/database/fields/{field_id}/generate-ai-field-values/ \
  --header 'Authorization: JWT {access_token}' \
  --header 'Content-Type: application/json' \
  --data '{
	"row_ids": [3,6]
}'

Moreover you will need to specify the row_ids in the body for the rows where you want the AI field to be (re)generated.

Ah that makes sense! Thank you! In the meantime, I used n8n to generate the AI prompt from the BaseRow data and send the response back to Baserow. A few extra stepts, but it works. I might doing it using your explanation for neatness! cheers.