-
Notifications
You must be signed in to change notification settings - Fork 13
skill with descriptive nl-sql generation #147
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
Open
chen0040
wants to merge
10
commits into
main
Choose a base branch
from
feat/golden-dataset-generation-seed-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dee54bc
skill with descriptive nl-sql generation
chen0040 a5b9c2f
update eval cujs
chen0040 59e423f
remove batching concept from the eval dataset gen skill
chen0040 70fb3ed
fix ai comments
chen0040 4241aa1
cicd: fix smoke test (#150) (#152)
chen0040 1ded40d
update sampling strategy
chen0040 cbc19a6
make sampling explanation in the generation plan more explicit
chen0040 f186b2e
add biz rule shift resolution and reduce cujs to 5
chen0040 4ad3a59
minor fix on teh cul eval
chen0040 7404aef
empty commit
chen0040 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
|
|
||
| ## CUJ: case_flights | ||
|
|
||
| **Setup**: In this CUJ, the user only provides the https://docs.cloud.google.com/alloydb/docs/ai/integrate-applications-data-agent documentation link. | ||
|
|
||
| **Source**: database is `db_dummy`, which does not contain any table. | ||
|
|
||
| **Expected Outcome**: The eval dataset generator needs to figure out based on the documentation at https://docs.cloud.google.com/alloydb/docs/ai/integrate-applications-data-agent what NL-SQL pairs to generate. | ||
|
|
||
|
|
||
| ## CUJ: case_property_search | ||
|
|
||
| **Setup**: In this CUJ, the user only provides the github link https://github.com/kupp0/multi-db-property-search-data-agents. | ||
|
|
||
| **Source**: database is `search`, which contains test data for the app. | ||
|
|
||
| **Expected Outcome**: The eval dataset generator needs to figure out based on the application source codes at https://github.com/kupp0/multi-db-property-search-data-agents what NL-SQL pairs to generate. | ||
|
|
||
| ## CUJ: case_blog | ||
|
|
||
| **Setup**: In this CUJ, the user provides the `app_data` folder containing a `ER_Diagram.jpg` which sketch the ER diagram for blog application as well as its `design_doc.pdf`. | ||
|
|
||
| **Source**: database is `db_dummy`, which does not contain any table. | ||
|
|
||
| **Expected Outcome**: The eval dataset generator need to figure out that the `<source>-list-schemas` returns the empty schema (since the user did not create any table in the schema), infers the schema from the `ER_Diagram.jpg` and makes use of the content in the `design_doc.pdf` to generate NL-SQL pairs. | ||
|
|
||
| ## CUJ: case_ecommerce_cryptic | ||
|
|
||
| **Setup**: In this CUJ, the user provides a business context doc containing explaination over the cryptic column names in the database | ||
|
|
||
| **Source**: database is `db_ecommerce_cryptic`, which contains cryptic column names | ||
|
|
||
| **Expected Outcome**: The eval dataset generator needs to figure out how to generate NL which leverage domain knowledge from the business context doc which explains the cryptic column names, and its corresponding SQL only knows the cryptic column names. | ||
|
|
||
| ## CUJ: case_financials | ||
|
|
||
| **Setup**: In this CUJ, the user provides the querylog file `querylog.txt` which simulates the query log for the `financials` database. | ||
|
|
||
| **Source**: database is `financials` from BIRD. | ||
|
|
||
| **Expected Outcome**: The eval dataset generator needs to figure out how to extract the SQL from the query log, and then translate them to the corresponding NL while ensuring the NL is unambiguous and logically align with the SQL. In the case the number of pairs user ask is more than the SQLs in the querylog, the eval dataset generator needs to uses its knowledge and inspection of querylog to come up with more NL-SQL pairs. | ||
|
|
||
| ## CUJ: case_hr | ||
|
|
||
| **Setup**: In this CUJ, the user provides the `app_data` directory containing the application codes. | ||
|
|
||
| **Source**: database is the `db_hr`. | ||
|
|
||
| **Expected Outcome**: The eval dataset generator needs to figure out which tables and columns to use to generate NL-SQL so that it alighns with the application codes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| { | ||
| "scenarios": [ | ||
| { | ||
| "id": "autoctx:generate-dataset-grounding-db-schema", | ||
| "starting_prompt": "generate a evaluation dataset consisting of simple SQL/Question pairs for my alloydb database financial named golden.json", | ||
| "conversation_plan": "Ask the agent to generate a evaluation dataset of SQL/Question pairs for my alloydb database financial named golden.json. You should terminate the conversation immediately after the agent successfully generated the dataset, even if the agent prompts you to perform evaluation or take next steps.", | ||
| "expected_trajectory": [], | ||
| "kind": "agents", | ||
| "work_dir": "workspace_grounding_db_schema/", | ||
| "max_turns": 15 | ||
| }, | ||
| { | ||
| "id": "autoctx:generate-dataset-grounding-github-code", | ||
| "starting_prompt": "generate a seed evaluation dataset consisting of advanced SQL/Question pairs for property search application named golden.json", | ||
| "conversation_plan": "Ask the agent to generate a evaluation dataset of SQL/Question pairs in postgres dialect for the application at https://github.com/kupp0/google-dach-summit26-database-labs/tree/main/labs/03_fullstack_ai_app_property_search, save the generated pairs in output file named golden.json. You should terminate the conversation immediately after the agent successfully generated the dataset, even if the agent prompts you to perform evaluation or take next steps.", | ||
| "expected_trajectory": [], | ||
| "kind": "agents", | ||
| "work_dir": "workspace_grounding_github_code/", | ||
| "max_turns": 15 | ||
| }, | ||
| { | ||
| "id": "autoctx:generate-dataset-grounding-web-doc", | ||
| "starting_prompt": "generate a seed evaluation dataset consisting of advanced SQL/Question pairs for flight booking application named golden.json", | ||
| "conversation_plan": "Ask the agent to generate a evaluation dataset consisting of 5 expert SQL/Question pairs in postgres dialect for the flight booking application at https://docs.cloud.google.com/alloydb/docs/ai/integrate-applications-data-agent, save the generated pairs in output file named golden.json. You should terminate the conversation immediately after the agent successfully generated the dataset, even if the agent prompts you to perform evaluation or take next steps.", | ||
| "expected_trajectory": [], | ||
| "kind": "agents", | ||
| "work_dir": "workspace_grounding_web_doc/", | ||
| "max_turns": 15 | ||
| }, | ||
| { | ||
| "id": "autoctx:generate-dataset-grounding-local-code", | ||
| "starting_prompt": "generate a seed evaluation dataset consisting of advanced SQL/Question pairs for hr application named golden.json", | ||
| "conversation_plan": "Ask the agent to generate a evaluation dataset of SQL/Question pairs in postgres dialect for the hr application whose source codes can be found in the directory `./app_data`, save the generated pairs in output file named golden.json. You should terminate the conversation immediately after the agent successfully generated the dataset, even if the agent prompts you to perform evaluation or take next steps.", | ||
| "expected_trajectory": [], | ||
| "kind": "agents", | ||
| "work_dir": "workspace_grounding_local_code/", | ||
| "max_turns": 15 | ||
| }, | ||
| { | ||
| "id": "autoctx:generate-dataset-resolve-cryptic-schema", | ||
| "starting_prompt": "generate a seed evaluation dataset consisting of advanced SQL/Question pairs for ecommerce application named golden.json", | ||
| "conversation_plan": "Ask the agent to generate a evaluation dataset of SQL/Question pairs in postgres dialect for the ecommerce application whose business context doc can be found in the directory `./app_data`, save the generated pairs in output file named golden.json. You should terminate the conversation immediately after the agent successfully generated the dataset, even if the agent prompts you to perform evaluation or take next steps.", | ||
| "expected_trajectory": [], | ||
| "kind": "agents", | ||
| "work_dir": "workspace_resolve_cryptic_schema/", | ||
| "max_turns": 15 | ||
| }, | ||
| { | ||
| "id": "autoctx:generate-dataset-grounding-multimodal", | ||
| "starting_prompt": "generate a seed evaluation dataset consisting of advanced SQL/Question pairs for blog application named golden.json", | ||
| "conversation_plan": "Ask the agent to generate a evaluation dataset of SQL/Question pairs in postgres dialect for the blog application whose er diagram and design doc can be found in the directory `./app_data`, save the generated pairs in output file named golden.json. You should terminate the conversation immediately after the agent successfully generated the dataset, even if the agent prompts you to perform evaluation or take next steps.", | ||
| "expected_trajectory": [], | ||
| "kind": "agents", | ||
| "work_dir": "workspace_grounding_multimodal/", | ||
| "max_turns": 15 | ||
| }, | ||
| { | ||
| "id": "autoctx:generate-dataset-grounding-querylog", | ||
| "starting_prompt": "generate a seed evaluation dataset consisting of SQL/Question pairs for my alloydb database financials named golden.json", | ||
| "conversation_plan": "Ask the agent to generate a evaluation dataset consisting of 5 SQL/Question pairs in postgres dialect for my alloydb database financial whose query log can be found in the file `./app_data/querylog.txt`, save the generated pairs in output file named golden.json. You should terminate the conversation immediately after the agent successfully generated the dataset, even if the agent prompts you to perform evaluation or take next steps.", | ||
| "expected_trajectory": [], | ||
| "kind": "agents", | ||
| "work_dir": "workspace_grounding_querylog/", | ||
| "max_turns": 15 | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| ############################################################ | ||
| ### Dataset / Eval Items | ||
| ############################################################ | ||
| dataset_config: eval-dataset-gen/dataset.json | ||
| dataset_format: gemini-cli-format | ||
|
|
||
| # Orchestrator Configuration | ||
| # `agent` is the alias of `geminicli` that also drives Claude Code. | ||
| orchestrator: agent | ||
| model_config: model_configs/claude_code_model.yaml | ||
| simulated_user_model_config: model_configs/gemini_model.yaml | ||
|
|
||
| # Run scenarios sequentially: Claude Code shares ~/.claude session store | ||
| # inside the sandboxed fake_home, so concurrent runs can conflict. | ||
| runners: | ||
| agent_runners: 1 | ||
|
|
||
| ############################################################ | ||
| ### Scorer Related Configs | ||
| ############################################################ | ||
| scorers: | ||
| trajectory_matcher: {} | ||
|
|
||
| goal_completion: | ||
| model_config: model_configs/gemini_model.yaml | ||
|
|
||
| turn_count: {} | ||
| end_to_end_latency: {} | ||
| tool_call_latency: {} | ||
| token_consumption: {} | ||
|
|
||
| ############################################################ | ||
| ### Reporting Related Configs | ||
| ############################################################ | ||
| reporting: | ||
| csv: | ||
| output_directory: 'results' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| ############################################################ | ||
| ### Dataset / Eval Items | ||
| ############################################################ | ||
| dataset_config: eval-dataset-gen/dataset.json | ||
| dataset_format: gemini-cli-format | ||
|
|
||
| # Orchestrator Configuration | ||
| orchestrator: geminicli | ||
| model_config: model_configs/gemini_cli_model.yaml | ||
| simulated_user_model_config: model_configs/gemini_model.yaml | ||
|
|
||
| ############################################################ | ||
| ### Scorer Related Configs | ||
| ############################################################ | ||
| scorers: | ||
| # Checks if the agent used the expected tools in the correct order. | ||
| trajectory_matcher: {} | ||
|
|
||
| # Uses an LLM to judge if the user's goal was met. | ||
| goal_completion: | ||
| model_config: model_configs/gemini_model.yaml | ||
|
|
||
| # Metrics for efficiency and performance. | ||
| turn_count: {} | ||
| end_to_end_latency: {} | ||
| tool_call_latency: {} | ||
| token_consumption: {} | ||
|
|
||
| ############################################################ | ||
| ### Reporting Related Configs | ||
| ############################################################ | ||
| reporting: | ||
| csv: | ||
| output_directory: 'results' |
Empty file.
1 change: 1 addition & 0 deletions
1
evals/eval-dataset-gen/workspace_grounding_db_schema/autoctx/state.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # context authoring experiment state tracking |
33 changes: 33 additions & 0 deletions
33
evals/eval-dataset-gen/workspace_grounding_db_schema/autoctx/tools.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| kind: source | ||
| name: my-alloydb | ||
| type: alloydb-postgres | ||
| project: cloud-db-nl2sql | ||
| region: us-central1 | ||
| cluster: whaoyu-test | ||
| instance: whaoyu-test-primary | ||
| database: financial | ||
| --- | ||
| kind: tool | ||
| name: my-alloydb-list-schemas | ||
| type: postgres-list-tables | ||
| source: my-alloydb | ||
| description: | | ||
| Use this tool to list tables and their schemas in the my-alloydb database. | ||
|
|
||
| Progressive Schema Discovery (Recommended): | ||
| 1) Fetch structure first (output_format='simple'), | ||
| 2) Go deep on specific parts if interested, | ||
| 3) Use batching if info is too large. | ||
|
|
||
| Scope: | ||
| - The tool can fetch system/extension schemas. Agents should ignore them and focus on user data. | ||
|
|
||
| Behavior: | ||
| - Omit 'table_names' to fetch all tables. | ||
| - Omit 'output_format' for detailed schema (default). | ||
| --- | ||
| kind: tool | ||
| name: my-alloydb-execute-sql | ||
| type: postgres-execute-sql | ||
| source: my-alloydb | ||
| description: Use this tool to execute SQL statements against the my-alloydb database. |
61 changes: 61 additions & 0 deletions
61
evals/eval-dataset-gen/workspace_grounding_github_code/app_data/db_schema.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| CREATE EXTENSION IF NOT EXISTS vector CASCADE; | ||
| CREATE EXTENSION IF NOT EXISTS alloydb_scann CASCADE; | ||
|
|
||
| -- 2. TABLE CREATION | ||
| DROP TABLE IF EXISTS user_prompt_history CASCADE; | ||
|
|
||
| CREATE TABLE public.user_prompt_history ( | ||
| id SERIAL PRIMARY KEY, | ||
| "timestamp" timestamp without time zone DEFAULT CURRENT_TIMESTAMP, | ||
| user_prompt text, | ||
| prompt_embedded vector(3072), | ||
| query_template_used boolean, | ||
| query_template_id integer, | ||
| query_explanation text | ||
| ); | ||
|
|
||
| DROP TABLE IF EXISTS property_listings CASCADE; | ||
|
|
||
| CREATE TABLE property_listings ( | ||
| id SERIAL PRIMARY KEY, | ||
| title VARCHAR(255) NOT NULL, | ||
| description TEXT, | ||
| price DECIMAL(12, 2) NOT NULL, | ||
| bedrooms INT, | ||
| city VARCHAR(100), | ||
| image_gcs_uri TEXT, | ||
| country VARCHAR(100) DEFAULT 'Switzerland', | ||
| canton VARCHAR(100), | ||
| -- Embeddings are generated externally and inserted directly | ||
| description_embedding VECTOR(3072) , | ||
| image_embedding VECTOR(1408) | ||
| ); | ||
|
|
||
| -- 2.1 COLUMN METADATA COMMENTS (Gemini Context Enrichment) | ||
| COMMENT ON COLUMN property_listings.bedrooms IS '<gemini>Examples: [''4'', ''6'', ''3''] | Distinct Values: 7 | Null Count: 0 |</gemini>'; | ||
| COMMENT ON COLUMN property_listings.canton IS '<gemini>Examples: [''Solothurn'', ''Ticino'', ''Zug''] | Distinct Values: 27 | Null Count: 0 |</gemini>'; | ||
| COMMENT ON COLUMN property_listings.city IS '<gemini>Examples: [''Stans'', ''Altdorf'', ''Kilchberg''] | Distinct Values: 89 | Null Count: 0 |</gemini>'; | ||
| COMMENT ON COLUMN property_listings.country IS '<gemini>Examples: [''Switzerland''] | Distinct Values: 1 | Null Count: 0 |</gemini>'; | ||
| COMMENT ON COLUMN property_listings.description IS '<gemini>Examples: [''The central rail crossroad of Switzerland. Reach anywhere fast. Modern functional apartment.'', ''Cozy retreat for weekend getaways or permanent living.''] | Distinct Values: 250 | Null Count: 0 |</gemini>'; | ||
| COMMENT ON COLUMN property_listings.id IS '<gemini>Examples: [''75'', ''247'', ''13''] | Distinct Values: 250 | Null Count: 0 |</gemini>'; | ||
| COMMENT ON COLUMN property_listings.image_gcs_uri IS '<gemini>Examples: [''https://storage.googleapis.com/property-images-data-agent-ai-powered-search-alloydb-1542/listings/10.jpg''] | Distinct Values: 250 | Null Count: 0 |</gemini>'; | ||
| COMMENT ON COLUMN property_listings.price IS '<gemini>Examples: [''11878.00'', ''4869.00'', ''2792.00''] | Distinct Values: 189 | Null Count: 0 |</gemini>'; | ||
| COMMENT ON COLUMN property_listings.title IS '<gemini>Examples: [''Rustic Studio in Landquart'', ''Renovated Villa in Herisau'', ''Quiet Home in Appenzell''] | Distinct Values: 248 | Null Count: 0 |</gemini>'; | ||
|
|
||
|
|
||
| -- 3. INDEX CREATION (ScaNN). Follow index sql files after data is loaded. | ||
|
|
||
| -- 4. MODEL ALIASING (Vertex AI Integration) | ||
| CREATE EXTENSION IF NOT EXISTS google_ml_integration CASCADE; | ||
|
|
||
|
|
||
| -- 4.1 Test Text Embeddings in Database Vertex AI integration | ||
| SELECT google_ml.embedding( | ||
| model_id => 'gemini-embedding-001', | ||
| content => 'This is the text to embed.' | ||
| ); | ||
| SELECT google_ml.embedding( | ||
| model_id => 'multimodalembedding@001', | ||
| content => 'This is the text to embed.' | ||
| ); | ||
|
|
Empty file.
1 change: 1 addition & 0 deletions
1
evals/eval-dataset-gen/workspace_grounding_github_code/autoctx/state.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # context authoring experiment state tracking |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.