From 73cea8a9c9e9d50ed1c4f31f2b9a12d133a99c84 Mon Sep 17 00:00:00 2001 From: peterdanwan Date: Thu, 12 Sep 2024 16:59:07 -0400 Subject: [PATCH 1/4] fixed banner --- src/commanderProgram.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commanderProgram.js b/src/commanderProgram.js index 0300b8d..eb9f7e1 100644 --- a/src/commanderProgram.js +++ b/src/commanderProgram.js @@ -14,7 +14,7 @@ const program = new Command(); // Custom Banner program.addHelpText( 'beforeAll', - chalk.blue('********************** gimme_readme (version: ${version}) ***********************') + chalk.blue(`********************** gimme_readme (version: ${version}) ***********************`) ); // Colourized Description using ANSI escape codes From 4d9e6b5799fa2f6425ec4545296f45c17531a564 Mon Sep 17 00:00:00 2001 From: peterdanwan Date: Thu, 12 Sep 2024 17:32:31 -0400 Subject: [PATCH 2/4] updated the getting started section to have another setup instruction --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index cb973ee..9c783b7 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,11 @@ To use the `gimme_readme`, you must: 1. Install the latest version of [node](https://nodejs.org/en/download/package-manager) for your `operating system`. 2. Run `npm i -g gimme_readme`, which installs `gimme_readme` globally. +3. Run `gr-ai -c` to generate your own `.gimme_readme_config` file in your `home` directory. + - `NOTE`: Do _not_ move this file from this location. + - Follow the prompts in recently created `.gimme_readme_config` file to add your API keys and preferred default values + - Leave the variable names in the newly generated config file alone. + - subsequent runs of `gr-ai -c` will just show you the path of your config file ## 3. Example Usage From 9dd17a19194b2fdbd9100c6b5a5b5ee4c529214a Mon Sep 17 00:00:00 2001 From: peterdanwan Date: Thu, 12 Sep 2024 17:33:25 -0400 Subject: [PATCH 3/4] program now looks for the .gimme_readme_config file in the user's home directory --- src/_gr.js | 11 +++++------ src/ai_config/geminiConfig.js | 5 ++++- src/ai_config/groqConfig.js | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/_gr.js b/src/_gr.js index f6bd756..5c73e23 100644 --- a/src/_gr.js +++ b/src/_gr.js @@ -14,7 +14,8 @@ import chalk from 'chalk'; import ora from 'ora'; // Load .gimme_readme_config as environment variables -dotenv.config({ path: '.gimme_readme_config' }); +const configFilePath = path.join(os.homedir(), '.gimme_readme_config'); +dotenv.config({ path: configFilePath }); async function main() { const args = process.argv; @@ -29,21 +30,19 @@ async function main() { // Handle the config option if (options.config) { - // Determine the config file path in the user's home directory - const configFilePath = path.join(os.homedir(), '.gimme_readme_config'); if (!fs.existsSync(configFilePath)) { // Create a default config file if it doesn't exist fs.writeFileSync( configFilePath, 'GEMINI_KEY=your-gemini-api-key\nOPENAI_KEY=your-openai-api-key\nMODEL=gemini\nCUSTOM_PROMPT=Your custom prompt here' ); - console.log(`Configuration file created at: ${configFilePath}`); + console.log(`Configuration file created at: ${chalk.blue(configFilePath)}`); } else { - console.log(`Configuration file located at: ${configFilePath}`); + console.log(`Configuration file located at: ${chalk.blue(configFilePath)}`); } console.log( - 'Please refer to the `gimme_readme` repository for examples on how to configure this file: https://github.com/peterdanwan/gimme_readme' + `Please refer to the ${chalk.blue('gimme_readme')} repository for examples on how to configure this file: ${chalk.blue('https://github.com/peterdanwan/gimme_readme')}` ); process.exit(0); diff --git a/src/ai_config/geminiConfig.js b/src/ai_config/geminiConfig.js index 9134dac..3f0d077 100644 --- a/src/ai_config/geminiConfig.js +++ b/src/ai_config/geminiConfig.js @@ -3,9 +3,12 @@ // Reference: https://ai.google.dev/gemini-api/docs/text-generation?lang=node import { GoogleGenerativeAI } from '@google/generative-ai'; import dotenv from 'dotenv'; +import os from 'os'; +import path from 'path'; // Make values from .env available -dotenv.config({ path: '.gimme_readme_config' }); +const configFilePath = path.join(os.homedir(), '.gimme_readme_config'); +dotenv.config({ path: configFilePath }); // Initialize Google Generative AI client const genAI = new GoogleGenerativeAI(process.env.GEMINI_KEY); diff --git a/src/ai_config/groqConfig.js b/src/ai_config/groqConfig.js index ef6c5d9..c0b8c06 100644 --- a/src/ai_config/groqConfig.js +++ b/src/ai_config/groqConfig.js @@ -3,14 +3,15 @@ // Reference: https://console.groq.com/docs/text-chat#performing-a-basic-chat-completion import Groq from 'groq-sdk'; import dotenv from 'dotenv'; +import os from 'os'; +import path from 'path'; // Make values from .env available -dotenv.config({ path: '.gimme_readme_config' }); +const configFilePath = path.join(os.homedir(), '.gimme_readme_config'); +dotenv.config({ path: configFilePath }); // Initialize groq AI client -const groq = new Groq({ - apiKey: process.env.GROQ_KEY, // Replace with your actual environment variable -}); +const groq = new Groq({ apiKey: process.env.GROQ_KEY }); // Export function to handle Groq-specific prompting export async function promptGroq(prompt, model, temperature = 0.5) { From 9f55b3a90a4e44bd61145da3f1ba0102bd2afd04 Mon Sep 17 00:00:00 2001 From: peterdanwan Date: Thu, 12 Sep 2024 18:38:58 -0400 Subject: [PATCH 4/4] added list of supported models to README.md --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9c783b7..2136d7d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ 1. [What is gimme_readme?][1-what-is-gimme-readme] 2. [Getting Started][2-getting-started] 3. [Example Usage][3-example-usage] -4. [Contributing][4-contributing] +4. [List of supported models by providers][4-list-of-supported-models-by-providers] +5. [Contributing][5-contributing] ## 1. What is gimme_readme? @@ -40,7 +41,14 @@ gr -v gr --version ``` -## 4. Contributing +## 4. List of supported models by providers + +| Provider | Models | +| -------- | ---------------- | +| `gemini` | gemini-1.5-flash | +| `groq` | llama3-8b-8192 | + +## 5. Contributing Contributions to this project are welcomed! @@ -53,4 +61,5 @@ Otherwise, if your issue or suggestion is not already list, please feel free to [1-what-is-gimme-readme]: #1-what-is-gimme_readme [2-getting-started]: #2-getting-started [3-example-usage]: #3-example-usage -[4-contributing]: #4-contributing +[4-list-of-supported-models-by-providers]: #4-list-of-supported-models-by-providers +[5-contributing]: #5-contributing