Skip to content

Commit

Permalink
Editing documentation for OpenAI org id
Browse files Browse the repository at this point in the history
  • Loading branch information
ggalmeida0 committed Aug 28, 2023
1 parent a81b4d6 commit 97f25e7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Add these in a .env file inside the root of the repo.

- `GOOGLE_CLIENT_ID`: Your Google OAuth client id (should be in the same page as the client secret). Will be used by Congnito to perform Google login.
- `OAUTH_CALLBACK_URL`: A comma separated list of URLs. These are the acceptable URLs to be redirected after performing OAuth, include localhost URLs.
- `OPENAI_ORG_ID`: The org id from your open ai account. Can be found in your [platform settings](https://platform.openai.com)

### Deploy cloud resources

Expand All @@ -56,7 +57,8 @@ Create a file `service/env/dev-env-vars.json` with the form:
{
"Parameters": {
"USER_POOL_CLIENT_ID": "<Your user pool client id in AWS>",
"USER_POOL_ID": "<Your user pool id in AWS>"
"USER_POOL_ID": "<Your user pool id in AWS>",
"OPENAI_ORG_ID": "<Your OpenAI org id>"
}
}
```
Expand Down
1 change: 1 addition & 0 deletions infra/lib/bio-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export class BioStack extends cdk.Stack {
environment: {
USER_POOL_ID: userPool.userPoolId,
USER_POOL_CLIENT_ID: client.userPoolClientId,
OPENAI_ORG_ID: getFromEnvironment().openAiOrgId,
},
memorySize: 1024,
});
Expand Down
7 changes: 6 additions & 1 deletion infra/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ export type Environment = {
googleClientId: string;
isDevEnv: boolean;
oAuthCallbackUrls: string[];
openAiOrgId: string;
};

export function getFromEnvironment(): Environment {
const googleClientId = process.env['GOOGLE_CLIENT_ID'];
const isDevEnv = !!process.env.IS_DEV_ENV;
const openAiOrgId = process.env.OPENAI_ORG_ID;
const oAuthCallbackUrls = process.env.OAUTH_CALLBACK_URLS?.split(',');
if (googleClientId == null) {
throw new Error('Please set GOOGLE_CLIENT_ID. More details in README.md');
}
if (oAuthCallbackUrls == null) {
throw new Error('Please set OAUTH_CALLBACK_URL. More details in README.md');
}
return { googleClientId, isDevEnv, oAuthCallbackUrls };
if (openAiOrgId == null) {
throw new Error('Please set OPENAI_ORG_ID. More details in README.md');
}
return { googleClientId, isDevEnv, oAuthCallbackUrls, openAiOrgId };
}
12 changes: 12 additions & 0 deletions service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@dqbd/tiktoken": "^1.0.7",
"aws-jwt-verify": "^4.0.0",
"aws-sdk": "^2.1386.0",
"dotenv": "^16.3.1",
"luxon": "^3.3.0",
"mathjs": "^11.8.2",
"openai": "^3.3.0"
Expand Down
2 changes: 1 addition & 1 deletion service/src/clients/OpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class OpenAI {
credentialsSecret.SecretString || ''
).OPENAI_API_KEY;
const configuration = new Configuration({
organization: 'org-0nCbMxaROs5ezAvk6hU9LypS',
organization: process.env.OPENAI_ORG_ID,
apiKey,
});

Expand Down

0 comments on commit 97f25e7

Please sign in to comment.