Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
22.75k stars 1.57k forks source link

Budi 8677 ai column type v1 #14711

Closed shogunpurple closed 1 month ago

shogunpurple commented 1 month ago

Description

This PR contains the new budibase AI column - a new column type that allows you to specify a function to be carried out by an LLM, pass in some of your row data, and have the LLM write the prompt into the Budibase DB. The AI functions Budibase provides are as follows:

AI columns are generated when you save a new row, edit it, or use the right click context menu to generate the columns for a previously saved row.

Pro PR: https://github.com/Budibase/budibase-pro/pull/322

Addresses

Screenshots

Screenshot 2024-10-04 at 17 37 21 Screenshot 2024-10-04 at 17 37 40

Launchcontrol

The budibase AI column allows you to perform LLM operations over your data - summarise text, run translations, perform sentiment analysis and much more simply by creating an AI column and saving/editing your data. You can also generate data from rows saved previously by right clicking and using the "Generate AI Columns" functionality on your row.

linear[bot] commented 1 month ago

BUDI-8677 AI column type V1

aptkingston commented 1 month ago

Doing a thorough review now, but the first snag I hit after generating a license to test this is that attempting to save a row (in a random table with no AI columns) threw an error The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }). So I assume other self hosters on non-free licenses would also hit this. We should probably fail gracefully if you aren't using any AI features and so don't have any AI configs set up. Also possible I just did something wrong.

Edit: what's the correct way to get AI up and running? The default Budibase AI config is present and enabled but can't be configured, and I've tried adding the OPENAI_API_KEY env var but that didn't work either. Would just like to test the feature properly 👌

shogunpurple commented 1 month ago

Doing a thorough review now, but the first snag I hit after generating a license to test this is that attempting to save a row (in a random table with no AI columns) threw an error The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }). So I assume other self hosters on non-free licenses would also hit this. We should probably fail gracefully if you aren't using any AI features and so don't have any AI configs set up. Also possible I just did something wrong.

Edit: what's the correct way to get AI up and running? The default Budibase AI config is present and enabled but can't be configured, and I've tried adding the OPENAI_API_KEY env var but that didn't work either. Would just like to test the feature properly 👌

@aptkingston This happens because the license generation on self host/dev env gives all the features - including Budibase AI (the cloud config) and custom configs. So it assumes you have the cloud config switched on, and tries to go to OpenAI. If you add OPENAI_API_KEY to your .env in server and restart, you should be able to use the AI features as normal.

shogunpurple commented 1 month ago

@aptkingston thanks for the review - they have all been addressed, some nice catches there 🙏