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: encourage ai to explain query #514

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion rust/wasm-binding/src/rpc_proto_prompt_functions_generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,16 @@ Additional metadata for {{ reference.model_name }}:

{% endfor %}

Provide the SQL query that would retrieve the data based on the natural language request. The SQL query should be valid for the database type {{ database_type }}.
Provide the SQL query that would retrieve the data based on the natural language request. In addition to generating the SQL code,
please provide a brief explanation of the query. The SQL query should be valid for the database type {{ database_type }}.
The provided tables are available in the `q.` schema. To access tehm use the `q.` prefix, for example `q.table_name`.

A few general rules about the SQL queries you generate:
- Use the `q.` prefix to access the tables.
- The output must be a SELECT statement.
- The output must be a valid SQL query for the database type {{ database_type }}.
- Prefer CTEs over subqueries.
- In SELECT statements where you join two tables, when referring to columns, use the table alias.
- Prefer JOINs over subqueries.
- Use aliases for columns where the name is not clear or ambiguous, like on aggregate functions.
"#;
Loading