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

Pull in recent bug fixes to main #8

Merged
merged 4 commits into from
Sep 12, 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
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand All @@ -17,6 +18,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

Expand All @@ -35,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!

Expand All @@ -48,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
11 changes: 5 additions & 6 deletions src/_gr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/ai_config/geminiConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions src/ai_config/groqConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/commanderProgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down