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

feat(text_to_sql): add include_entire_schema and only_these_objects o… #503

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

jgpruitt
Copy link
Collaborator

@jgpruitt jgpruitt commented Feb 20, 2025

…ptions to text-to-sql

  1. "Normal mode" semantic search
select ai.text_to_sql('How many flights arrived in Houston, TX in June 2024?');
  1. include_entire_schema - bypasses search and includes the entire schema in the prompt
select ai.text_to_sql('How many flights arrived in Houston, TX in June 2024?'
, config=>ai.text_to_sql_openai(model=>'o3-mini', include_entire_schema=>true)
);
  1. only_these_objects - bypasses search and only includes the specific tables/views in the prompt
select ai.text_to_sql('How many flights arrived in Houston, TX in June 2024?'
, config=>ai.text_to_sql_openai(model=>'o3-mini', only_these_objects=>array['postgres_air.flight', 'postgres_air.airport']::regclass[])
);

only_these_objects does not allow you to specify functions. I doubt we'll need that, and I doubt we'll keep this functionality. If we need to, we can add it later.

Also, we now extract the estimated cost and estimated rows from the query plan and return them

@jgpruitt jgpruitt self-assigned this Feb 20, 2025
@jgpruitt jgpruitt requested a review from a team as a code owner February 20, 2025 20:34
@jgpruitt jgpruitt merged commit 5a6481e into main Feb 21, 2025
5 checks passed
@jgpruitt jgpruitt deleted the jgpruitt/text-to-sql-stuff branch February 21, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants