Skip to content

Commit

Permalink
Update make readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnolte committed Feb 26, 2024
1 parent 5c1fbd3 commit fe42a1d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
3 changes: 2 additions & 1 deletion JavaScript/openai-assistants-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your Autoblocks api key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
AUTOBLOCKS_API_KEY=<your-api-key>
AUTOBLOCKS_API_KEY=<your-api-key
```

<!-- getting started end -->
Expand Down
3 changes: 2 additions & 1 deletion JavaScript/prompt-sdk-headless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your Autoblocks api key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
AUTOBLOCKS_API_KEY=<your-api-key>
AUTOBLOCKS_API_KEY=<your-api-key
```

<!-- getting started end -->
Expand Down
52 changes: 30 additions & 22 deletions tools/make-readmes.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,33 @@ const BANNER_START_COMMENT = '<!-- banner start -->';
const BANNER_END_COMMENT = '<!-- banner end -->';

// Getting started checklist we add to each individual project README
const makeGettingStartedChecklist = (includeOpenAI) => {
if (includeOpenAI) {
return `
## Getting started
- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named \`.env\` in this folder and include the following environment variables:
\`\`\`
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
\`\`\`
`;
} else {
return `
const makeGettingStartedChecklist = ({
includeOpenAI,
includeAutoblocksAPIKey,
}) => {
return `
## Getting started
- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
${
includeAutoblocksAPIKey
? '- Grab your Autoblocks api key from https://app.autoblocks.ai/settings/api-keys'
: 'DELETE_ME'
}
${
includeOpenAI
? '- Grab your OpenAI API key from https://platform.openai.com/account/api-keys'
: 'DELETE_ME'
}
- Create a file named \`.env\` in this folder and include the following environment variables:
\`\`\`
${includeOpenAI ? 'OPENAI_API_KEY=<your-api-key>' : 'DELETE_ME'}
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
${includeAutoblocksAPIKey ? 'AUTOBLOCKS_API_KEY=<your-api-key' : 'DELETE_ME'}
\`\`\`
`;
}
`.replaceAll('DELETE_ME\n', '');
};

const GETTING_STARTED_START_COMMENT = '<!-- getting started start -->';
Expand All @@ -100,6 +99,7 @@ const GETTING_STARTED_END_COMMENT = '<!-- getting started end -->';
for (const project of projects) {
let description;
let includeOpenAIInGettingStartedChecklist = false;
let includeAutoblocksAPIKeyInGettingStartedChecklist = false;

if (section === 'JavaScript') {
// Get description from package.json
Expand All @@ -109,6 +109,12 @@ const GETTING_STARTED_END_COMMENT = '<!-- getting started end -->';
);
description = JSON.parse(packageJson).description;

if (
packageJson.includes('dotenv -e .env -- autoblocks prompts generate')
) {
includeAutoblocksAPIKeyInGettingStartedChecklist = true;
}

// Check if openai is a dependency
if (packageJson.includes('openai')) {
includeOpenAIInGettingStartedChecklist = true;
Expand Down Expand Up @@ -147,9 +153,11 @@ const GETTING_STARTED_END_COMMENT = '<!-- getting started end -->';
content: projectReadme,
startComment: GETTING_STARTED_START_COMMENT,
endComment: GETTING_STARTED_END_COMMENT,
replacement: makeGettingStartedChecklist(
includeOpenAIInGettingStartedChecklist,
),
replacement: makeGettingStartedChecklist({
includeOpenAI: includeOpenAIInGettingStartedChecklist,
includeAutoblocksAPIKey:
includeAutoblocksAPIKeyInGettingStartedChecklist,
}),
});

// Write the new project README
Expand Down

0 comments on commit fe42a1d

Please sign in to comment.