From c54fb689c06c1237f2678a7d1a1bebef62fa4fbc Mon Sep 17 00:00:00 2001 From: Sualeh Fatehi Date: Sat, 17 Feb 2024 09:33:57 -0500 Subject: [PATCH] Update notes on ChatGPT integration --- .../src/site/markdown/schemacrawler-chatgpt.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/schemacrawler-website/src/site/markdown/schemacrawler-chatgpt.md b/schemacrawler-website/src/site/markdown/schemacrawler-chatgpt.md index 4196928d56..40e8f90ba6 100644 --- a/schemacrawler-website/src/site/markdown/schemacrawler-chatgpt.md +++ b/schemacrawler-website/src/site/markdown/schemacrawler-chatgpt.md @@ -1,6 +1,6 @@ # Interactive Shell with ChatGPT -SchemaCrawler is integrated with ChatGPT to provide an interactive way to interrogate your database schema metadata. No information about your database schema is shared with OpenAI. To start using this integration, you will need to create your own [OpenAI API key](https://www.howtogeek.com/885918/how-to-get-an-openai-api-key/). Once you have that, use SchemaCrawler from the command-line as you normally would, and connect to your database. Provide `chatgpt` as the SchemaCrawler command, and use an additional command-line argument, `--api-key` to provide your API key. If you do not want to provide this API key in the clear, you can use `--api-key:env` instead, and give the name of an environmental variable that contains the key. +SchemaCrawler is integrated with ChatGPT to provide an interactive way to interrogate your database schema metadata. No information about your database schema is shared with OpenAI. To start using this integration, you will need to create your own [OpenAI API key](https://www.howtogeek.com/885918/how-to-get-an-openai-api-key/). Once you have that, use SchemaCrawler from the command-line as you normally would, and connect to your database. Provide `chatgpt` as the SchemaCrawler command, and provide your OpenAI API key in an environmetal variable called `OPENAI_API_KEY`. Otherwise, you can use an additional command-line argument, `--api-key` to provide your API key. If you do not want to provide this API key in the clear, you can use `--api-key:env` instead, and give the name of an environmental variable that contains the key, if it is different than `OPENAI_API_KEY`. Once you have this running, you will have an interactive chat shell with ChatGPT, enhanced with information about your database metadata. You can try prompts such as the following ones: @@ -18,7 +18,7 @@ To quit the console, you can type something like: - I think I have everything I need - or simply, "done", "exit" or "quit" - + You can use any language that ChatGPT supports, for example, try something like: - Combien de tables y a-til dans cette base de données? @@ -27,16 +27,16 @@ You can use any language that ChatGPT supports, for example, try something like: - Décris-moi la table NoName -## Get Summary and Help on the Schema +## Get SQL and Other Help on Your Schema -If you are willing to share your database metadata with OpenAI, you can get additional help from ChatGPT. For example, you can summarize what the database does, get help with writing SQL queries, or with writing good comments on your database schema. To share data, pass an additional command-line argument to SchemaCrawler, `--use-metadata`. Please note that depending on your database schema, this can exceed the maximum tokens allowed by ChatGPT. If you end up exceeding the tokens, either do not use this flag, or use the SchemaCrawler command-line to limit the tables in scope using regular expressions. +If you are willing to share your database metadata with OpenAI, you can get additional help from ChatGPT. For example, you can get help with writing SQL queries, or with writing good comments on your database schema. To share data, pass an additional command-line argument to SchemaCrawler, `--use-metadata`. SchemaCrawler uses Retrieval Augmented Generation (RAG) techniques to select the tables in your schema that will be used to assist with your ChatGPT prompt. Try out prompts like (even though they may not return completely accurate information): -- Summarize the database in one paragraph - Based on my schema, write a SQL query for book names and author names - Based on my schema, write a SQL query to find all books that have previous editions -- Suggest remarks for columns that do not have them +- Suggest remarks for columns in the Books table +- Summarize the database in one paragraph ## Extensions