Files
supabase/apps/studio/evals/dataset.ts
T
Matt Rossman 4b8bab4d14 feat(assistant): score URL validity and fix support ticket URL guidance (#42227)
**Logic changes**
- Adds function in `helpers.ts` to extract URLs from text via regex
- I also considering using a library like
[linkify-it](https://www.npmjs.com/package/linkify-it) for this but
figured it's not worth the extra dep
- Adds associated tests in `helpers.test.ts`
- Adds "URL Validity" scorer which performs a HEAD request for links in
Assistant response text and determins what portion of links have `.ok`
responses
- Adds eval case to check correctness of support ticket URL answers

**Prompt changes**
- Informs Assistant of https://supabase.com/dashboard/support/new being
the URL to create support tickets
- Encourages Assistant to "self-debug" issues before directing users to
create support tickets

See [Eval
Report](https://github.com/supabase/supabase/pull/42227#issuecomment-3807772871)
and
[Correctness](https://www.braintrust.dev/app/supabase.io/p/Assistant/trace?object_type=experiment&object_id=1ad0f9b0-5adb-436c-9812-a87aac62c036&r=1ef13459-a98c-4904-925e-6d81276cebb2&s=dbe5c607-a560-462b-8745-41d430744431)
analysis for new support ticket test case.

Resolves AI-384

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added URL validity scoring to evaluations and helper utilities for
extracting/cleaning URLs.
* Added evaluation cases for support-ticket URL handling and OAuth
callback guidance.

* **Documentation**
* Updated assistant guidance to prefer self-resolution, include
support-ticket direction, clarified data-recovery search steps, and
added template-URL notation.

* **Tests**
* Expanded URL extraction and related utility tests to cover many
formats and edge cases.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-01-30 09:53:21 -05:00

131 lines
4.0 KiB
TypeScript

import { AssistantEvalCase } from './scorer'
export const dataset: AssistantEvalCase[] = [
{
input: { prompt: 'How do I run WASM in edge functions? Use `search_docs`.' },
expected: { requiredTools: ['search_docs'] },
metadata: { category: ['general_help'] },
},
{
input: {
prompt: 'Check if my project is having issues right now and tell me what to fix first.',
},
expected: {
requiredTools: ['get_advisors', 'get_logs'],
},
metadata: { category: ['debugging', 'rls_policies'] },
},
{
input: { prompt: 'Create a new table "foods" with columns for "name" and "color"' },
expected: {
requiredTools: ['execute_sql'],
},
metadata: { category: ['sql_generation', 'schema_design'] },
},
{
input: {
prompt:
'Write a SQL query to select all projects from the projects table where the name is not null',
},
expected: {
requiredTools: ['execute_sql'],
},
metadata: { category: ['sql_generation'] },
},
{
input: { prompt: 'Create an index on the projects table for the name column' },
expected: {
requiredTools: ['execute_sql'],
},
metadata: { category: ['sql_generation', 'database_optimization'] },
},
{
input: { prompt: 'How many projects are included in the free tier?' },
expected: {
requiredTools: ['search_docs'],
correctAnswer: '2',
},
metadata: { category: ['general_help'] },
},
{
input: { prompt: 'Restore my Supabase Storage files to the state from 3 days ago' },
expected: {
requiredTools: ['search_docs'],
correctAnswer:
'There is no way to restore these files. When you delete objects from a bucket, the files are permanently removed and not recoverable.',
},
metadata: { category: ['general_help'] },
},
{
input: { prompt: 'How do I enable S3 versioning in Supabase Storage?' },
expected: {
requiredTools: ['search_docs'],
correctAnswer: 'S3 versioning is not supported in Supabase Storage.',
},
metadata: { category: ['general_help'] },
},
{
input: {
prompt:
'Show me customer name, order date, order, and user from the order history table in MySchema where order is not null',
mockTables: {
MySchema: [
{
name: 'order-history',
rls_enabled: false,
columns: [
{ name: 'id', data_type: 'bigint' },
{ name: 'customerName', data_type: 'text' },
{ name: 'order-date', data_type: 'timestamp with time zone' },
{ name: 'order', data_type: 'uuid' },
{ name: 'user', data_type: 'text' },
{ name: 'total', data_type: 'numeric' },
],
},
],
},
},
expected: {
requiredTools: ['execute_sql'],
},
metadata: {
category: ['sql_generation'],
description:
'Uses quotes around schema/table/columns with capital letters, special characters, and reserved keywords.',
},
},
{
input: {
prompt: 'Generate sample data for a blog with users, posts, and comments tables',
},
expected: {
requiredTools: ['execute_sql'],
},
metadata: {
category: ['sql_generation', 'schema_design'],
description: 'Invokes `execute_sql` from default "Generate sample data" prompt',
},
},
{
input: { prompt: 'Where can I go to create a support ticket?' },
expected: {
correctAnswer: 'https://supabase.com/dashboard/support/new',
},
metadata: {
category: ['general_help'],
description: 'Verifies AI provides valid support ticket URL',
},
},
{
input: { prompt: 'What is my OAuth callback URL for setting up GitHub authentication?' },
expected: {
requiredTools: ['search_docs'],
},
metadata: {
category: ['general_help'],
description:
'Verifies template URLs like https://<project-ref>.supabase.co/auth/v1/callback are excluded from URL validity scoring',
},
},
]