Skip to content
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
8 changes: 4 additions & 4 deletions backend/PERPLEXITY_INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default () => ({
aws: {
// ... existing aws config
secretsManager: {
perplexityApiKeySecret: process.env.PERPLEXITY_API_KEY_SECRET_NAME || 'medical-reports-explainer/perplexity-api-key',
perplexityApiKeySecret: process.env.PERPLEXITY_API_KEY_SECRET_NAME || 'med-ai-perplexity-key',
},
},
perplexity: {
Expand Down Expand Up @@ -68,7 +68,7 @@ The `PerplexityController` exposes the following endpoints:
1. Create a secret in AWS Secrets Manager:
```
aws secretsmanager create-secret \
--name medical-reports-explainer/perplexity-api-key \
--name med-ai-perplexity-key \
--description "Perplexity API Key for Medical Reports Explainer" \
--secret-string "your-perplexity-api-key"
```
Expand All @@ -83,7 +83,7 @@ The `PerplexityController` exposes the following endpoints:
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": "arn:aws:secretsmanager:region:account-id:secret:medical-reports-explainer/perplexity-api-key-*"
"Resource": "arn:aws:secretsmanager:region:account-id:secret:med-ai-perplexity-key-*"
}
]
}
Expand All @@ -95,7 +95,7 @@ Configure the following environment variables:

| Variable | Description | Default Value |
|----------|-------------|---------------|
| `PERPLEXITY_API_KEY_SECRET_NAME` | Name of the secret in AWS Secrets Manager | `medical-reports-explainer/perplexity-api-key` |
| `PERPLEXITY_API_KEY_SECRET_NAME` | Name of the secret in AWS Secrets Manager | `med-ai-perplexity-key` |
| `PERPLEXITY_MODEL` | Perplexity model to use | `mixtral-8x7b-instruct` |
| `PERPLEXITY_MAX_TOKENS` | Maximum tokens to generate | `2048` |
| `AWS_REGION` | AWS region for Secrets Manager | `us-east-1` |
Expand Down
4 changes: 1 addition & 3 deletions backend/src/config/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export default () => ({
clientId: process.env.AWS_COGNITO_CLIENT_ID,
},
secretsManager: {
perplexityApiKeySecret:
process.env.PERPLEXITY_API_KEY_SECRET_NAME ||
'medical-reports-explainer/perplexity-api-key',
perplexityApiKeySecret: process.env.PERPLEXITY_API_KEY_SECRET_NAME || 'med-ai-perplexity-key',
},
aws: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
Expand Down
2 changes: 1 addition & 1 deletion backend/src/iac/backend-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export class BackendStack extends cdk.Stack {
DYNAMODB_REPORTS_TABLE: reportsTable.tableName,

// Perplexity related
PERPLEXITY_API_KEY_SECRET_NAME: `medical-reports-explainer/${props.environment}/perplexity-api-key`,
PERPLEXITY_API_KEY_SECRET_NAME: `med-ai-perplexity-key`,
PERPLEXITY_MODEL: 'sonar',
PERPLEXITY_MAX_TOKENS: '2048',

Expand Down
4 changes: 1 addition & 3 deletions backend/src/services/perplexity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ export class PerplexityService {
return this.apiKey;
}

const secretName =
this.configService.get<string>('aws.secretsManager.perplexityApiKeySecret') ||
'medical-reports-explainer/perplexity-api-key';
const secretName = this.configService.get<string>('aws.secretsManager.perplexityApiKeySecret');

if (!secretName) {
throw new Error('Perplexity API key secret name is not configured');
Expand Down