Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Budi 8677 ai column type v1 #14711

Merged
merged 26 commits into from
Oct 15, 2024
Merged

Budi 8677 ai column type v1 #14711

merged 26 commits into from
Oct 15, 2024

Conversation

shogunpurple
Copy link
Member

@shogunpurple shogunpurple commented Oct 4, 2024

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:

  • Summarise text
  • Clean data
  • Translate
  • Categorise Text
  • Sentiment Analysis
  • Free Prompt
  • Search Web

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.

Copy link

linear bot commented Oct 4, 2024

@shogunpurple shogunpurple marked this pull request as ready for review October 13, 2024 19:10
@shogunpurple shogunpurple requested a review from a team as a code owner October 13, 2024 19:10
@shogunpurple shogunpurple force-pushed the budi-8677-ai-column-type-v1 branch from 74f463a to cf8f7db Compare October 14, 2024 10:22
Copy link
Collaborator

@mike12345567 mike12345567 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - would it be possible to get test cases for search.spec.ts to make sure the column is searchable, as well as a test case to row.spec.ts which makes sure that the column can be added/updated on a row as expected? We may have to mock the LLM in these cases, but it would be good to confirm this flows correctly in these test cases.

We have test cases in these which use something like isSqs && describe(.... to make sure the test case only runs for internal DB.

@aptkingston
Copy link
Member

aptkingston commented Oct 14, 2024

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
Copy link
Member Author

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.

Copy link
Member

@aptkingston aptkingston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @shogunpurple 👌 great to see our first proper AI features.

One small improvement I think we should make is highlighting that AI cells are readonly in grids. We have a function in stores/columns.js called isReadonly that we use today to make things like formula cells readonly. So I think we should add the AI type in there too, and then it'll reflect its readonly nature properly by having a grey border.

When filtering on AI column in the design section it seems to bug out a little (the value field is disabled for some reason):
image
Maybe it's just not being considered as a searchable type properly? Haven't dug into the code to see why though.

The "generate AI columns" functionality is missing in client apps (maybe by design?) since the licensing value isn't being passed in. Not sure if we want to expose that or not though.
image

@shogunpurple
Copy link
Member Author

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

Copy link
Member

@aptkingston aptkingston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aptkingston aptkingston mentioned this pull request Oct 15, 2024
@shogunpurple shogunpurple merged commit a13cd07 into v3-ui Oct 15, 2024
10 of 11 checks passed
@shogunpurple shogunpurple deleted the budi-8677-ai-column-type-v1 branch October 15, 2024 10:34
@adrinr adrinr restored the budi-8677-ai-column-type-v1 branch October 17, 2024 10:25
@adrinr adrinr deleted the budi-8677-ai-column-type-v1 branch October 17, 2024 10:36
@adrinr adrinr restored the budi-8677-ai-column-type-v1 branch October 17, 2024 10:38
@adrinr adrinr deleted the budi-8677-ai-column-type-v1 branch October 17, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants