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

Enable evals on multiple databases for OpenAI and Anthropic generators #200

Merged
merged 8 commits into from
Jul 9, 2024

Conversation

rishsriv
Copy link
Member

@rishsriv rishsriv commented Jul 8, 2024

In addition:

  • pass through join hints to the OpenAI and Anthropic generator prompts when c=0. These do not make any significant difference to performance (the difference in +- 0.5% with and without for gpt-4o, gpt-4, and claude-3.5-sonnet), but we are passing them through for the sake of apples to apples comparisons with other models.
  • remove glossary from all prompts, as it is not needed

@rishsriv rishsriv changed the title Enable evals on multiple databases translation for OpenAI and Anthropic generators Enable evals on multiple databases for OpenAI and Anthropic generators Jul 8, 2024
postgres_ddl=pruned_metadata_str,
to_dialect=self.db_type,
db_name=self.db_name,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meaning we only do translation if there's no pruning? in gen_prompt.py the translation occurs only after the pruning/non-pruning

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix, thanks for spotting!

new_ddl, _ = ddl_to_tsql(postgres_ddl, "postgres", db_name, 42)
else:
raise ValueError(f"Unsupported dialect {to_dialect}")
return new_ddl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you wanna add this to utils.dialect so it doesn't have to be repeated across the files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!

postgres_ddl=table_metadata_ddl,
to_dialect=self.db_type,
db_name=self.db_name,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue raised above of adding translation after pruning/non-pruning

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix!

@wendy-aw
Copy link
Contributor

wendy-aw commented Jul 9, 2024

Thanks for incorporating translations in the openai/anthropic runners! Just a few comments from me.

@rishsriv
Copy link
Member Author

rishsriv commented Jul 9, 2024

Fixed, thanks Wendy!

@@ -110,16 +114,43 @@ def generate_query(
columns_to_keep,
shuffle,
)
pruned_metadata_ddl = convert_postgres_ddl_to_dialect(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry forgot to highlight earlier. But i rmb adding this extra line before the translation in gen_prompt.py:

# remove triple backticks
 pruned_metadata_ddl = pruned_metadata_ddl.replace("```", "").strip()

because sqlglot can't translate with those. would it also be a problem here and in the openai script?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this! Hasn't been a problem - sqlite evals for OpenAI and Anthropic both worked super smoothly :D

@wendy-aw wendy-aw self-requested a review July 9, 2024 08:30
@rishsriv rishsriv merged commit 04f65b9 into main Jul 9, 2024
2 checks passed
@rishsriv rishsriv deleted the rishabh/fix-openai-anthropic-conversion-joins branch July 9, 2024 08:34
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