|
| 1 | +--- |
| 2 | +title: 'Supabase AI Assistant v2' |
| 3 | +description: An evolution of how we approach AI within the Supabase dashboard |
| 4 | +author: saxon_fletcher,joshenlim |
| 5 | +image: launch-week-13/day-1-ai-assistant-v2/og.jpg |
| 6 | +thumb: launch-week-13/day-1-ai-assistant-v2/thumb.jpg |
| 7 | +categories: |
| 8 | + - developers |
| 9 | + - postgres |
| 10 | +tags: |
| 11 | + - AI |
| 12 | + - postgres |
| 13 | +date: '2024-12-02' |
| 14 | +toc_depth: 3 |
| 15 | +--- |
| 16 | + |
| 17 | +Today we releasing Supabase Assistant v2 in the dashboard - a global assistant with several new abilities: |
| 18 | + |
| 19 | +1. Postgres schema design |
| 20 | +1. Data queries and charting |
| 21 | +1. Error debugging |
| 22 | +1. Postgres RLS Policies: create and edit |
| 23 | +1. Postgres Functions: create and edit |
| 24 | +1. Postgres Triggers: create and edit |
| 25 | +1. SQL to `supabase-js` conversion |
| 26 | + |
| 27 | +## A new, unified approach to AI |
| 28 | + |
| 29 | +Our new Assistant more extensible, using a flexible system of components, tools, and APIs. You can provide context manually (e.g. an RLS Policy) or automatically based on whichever page you're visiting in the dashboard (e.g. the specific table you're working on). |
| 30 | + |
| 31 | +The result is a single panel that's persistent across the entire dashboard. It sits alongside your workspace and can be called upon when needed (`cmd+i`!). It automatically retrieves context for your prompt and can be provided with extra context similar to other AI tools like Cursor and GitHub Copilot. |
| 32 | + |
| 33 | +## New abilities in Supabase Assistant v2 |
| 34 | + |
| 35 | +Let's take a look at new abilities in this release. |
| 36 | + |
| 37 | +### Schema design |
| 38 | + |
| 39 | +If you are creating something new, the Assistant can guide or inspire you. It will show you how to structure your database and generate all the SQL queries to set it up. |
| 40 | + |
| 41 | +<Img |
| 42 | + alt="Design new database schemas" |
| 43 | + src="/images/blog/launch-week-13/day-1-ai-assistant-v2/design.png" |
| 44 | +/> |
| 45 | + |
| 46 | +### Writing SQL |
| 47 | + |
| 48 | +Like our previous Assistant, the new Assistant will help you write queries based on your schema. This version has better contextual understanding and can provide more accurate suggestions. |
| 49 | + |
| 50 | +### Debug your queries |
| 51 | + |
| 52 | +Writing SQL can be tough. You can use the new Assistant to debug database errors directly through the SQL Editor or within the Assistant panel. |
| 53 | + |
| 54 | +<Img |
| 55 | + alt="Debug your queries with AI" |
| 56 | + src="/images/blog/launch-week-13/day-1-ai-assistant-v2/debug.png" |
| 57 | +/> |
| 58 | + |
| 59 | +### Discover data insights |
| 60 | + |
| 61 | +The new Assistant can run queries directly. This can be a useful (and fun) way to query your data through natural language. Basic select queries run automatically, and results are displayed within the conversation in tabular form or chart form. The chart axis are picked intuitively by the Assistant. No data is sent to the underlying LLM, only your schema structure. This is a helpful tool for folks who are not comfortable with SQL but are still interested in analyzing data insights. |
| 62 | + |
| 63 | +<Img alt="Query data with AI" src="/images/blog/launch-week-13/day-1-ai-assistant-v2/query.png" /> |
| 64 | + |
| 65 | +### SQL to REST |
| 66 | + |
| 67 | +Once your database is set up, probably want to connect to it directly or with one of our client libraries. If you're using our `supabase-js` library, we've added a helpful tool to convert an SQL query to supabase-js client code. Simply ask the Assistant to convert a query, and it will respond with either a complete snippet for you to copy or a combination of function + RPC call. This is powered by the [sql-to-rest](/docs/guides/api/sql-to-rest) tool. |
| 68 | + |
| 69 | +<Img |
| 70 | + alt="Convert SQL to supabase-js code" |
| 71 | + src="/images/blog/launch-week-13/day-1-ai-assistant-v2/js.png" |
| 72 | +/> |
| 73 | + |
| 74 | +### RLS Policies: Protect your database |
| 75 | + |
| 76 | +Use the Assistant to suggest, create or modify RLS Policies. Simply explain the desired behavior and the Assistant will generate a new Policy using the context of your database schema and existing policies. To edit an existing policy, click “edit with Assistant” within your Policy list. The Assistant will be provided the appropriate context for you to start prompting. |
| 77 | + |
| 78 | +<Img |
| 79 | + alt="Create and edit RLS Policies with AI" |
| 80 | + src="/images/blog/launch-week-13/day-1-ai-assistant-v2/policy.png" |
| 81 | +/> |
| 82 | + |
| 83 | +### Postgres Functions and Triggers |
| 84 | + |
| 85 | +Suggest, create or update functions and triggers in a similar way to policies. Just describe what you want or select “Edit with Assistant” from your Function or Trigger list. |
| 86 | + |
| 87 | +<Img |
| 88 | + alt="Create and edit functions and triggers with AI" |
| 89 | + src="/images/blog/launch-week-13/day-1-ai-assistant-v2/functions.png" |
| 90 | +/> |
| 91 | + |
| 92 | +## Feedback |
| 93 | + |
| 94 | +This release gives us a foundation to build off and incorporate into other parts of your database journey. Where are you struggling the most when using Postgres? How might the Assistant help you? Send us your thoughts, ideas, concerns via the feedback form within the dashboard. |
| 95 | + |
| 96 | +## How to access |
| 97 | + |
| 98 | +Supabase Assistant v2 is available today. |
| 99 | +Go to a Project and hit `cmd + i`, or alternatively click the Assistant icon in the top right toolbar. |
0 commit comments