This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let axios = require('axios'); | |
const openAiApi = axios.create({ | |
baseURL: 'https://api.openai.com/v1/', | |
headers: { | |
Authorization: `Bearer ${gptKey}`, | |
'Content-Type': 'application/json' | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChromaClient } from 'chromadb'; | |
export const handler = async (event: APIGatewayEvent) => { | |
// ... ommitted | |
const client = new ChromaClient(CHROMADB_BASE_PATH); | |
const collection = await client.getCollection(userUuid); | |
const result = await collection.query(queryVector, 3); | |
const relevantEntryIds = result.ids[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChromaClient } from 'chromadb'; | |
export const handler = async (event: APIGatewayEvent) => { | |
// ... ommitted | |
const chromaDbClient = new ChromaClient(CHROMADB_BASE_PATH); | |
let userCollection = await chromaDbClient.getOrCreateCollection(userUuid); | |
const entryIds = [1, 2, 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { OpenAIEmbeddingFunction } from 'chromadb'; | |
/** | |
* Lambda API Gateway Event Handler | |
*/ | |
export const handler = async (event: APIGatewayEvent) => { | |
// ... ommitted | |
const journalEntryValues = ['entry1 data', 'entry2 data', 'entry3 data']; | |
const embedder = new OpenAIEmbeddingFunction(openAiApiKey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFDistribution: | |
#checkov:skip=CKV_AWS_68: "For demo purposes and to reduce cost, no WAF is configured" | |
Type: 'AWS::CloudFront::Distribution' | |
DependsOn: | |
- CFOriginAccessIdentity | |
Properties: | |
DistributionConfig: | |
Origins: | |
- DomainName: !GetAtt S3Bucket.RegionalDomainName | |
Id: myS3Origin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ViewerCertificate: | |
SslSupportMethod: sni-only | |
MinimumProtocolVersion: TLSv1.2_2021 | |
AcmCertificateArn: !Ref TonyCodesDNSCertificate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ViewerCertificate: | |
SslSupportMethod: sni-only | |
MinimumProtocolVersion: TLSv1 | |
AcmCertificateArn: !Ref TonyCodesDNSCertificate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TonyCodesDNSCertificate: | |
Type: AWS::CertificateManager::Certificate | |
Properties: | |
CertificateTransparencyLoggingPreference: DISABLED | |
DomainName: tonycodes.com | |
DomainValidationOptions: | |
- DomainName: tonycodes.com | |
HostedZoneId: Z05106722AGOCZ1FSFD3D | |
ValidationMethod: DNS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JumbleJournalDNSAliasRecord: | |
Type: AWS::Route53::RecordSetGroup | |
Properties: | |
HostedZoneId: Z05106123ABC456DEF789 | |
RecordSets: | |
- Name: tonycodes.com | |
Type: A | |
AliasTarget: | |
HostedZoneId: Z2FDTNDATAQYW2 | |
DNSName: !GetAtt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+─────────────────────────+───────────────────────────────────────────────────────────────────────────────────────+ | |
| User Interface | SAM Template | | |
+─────────────────────────+───────────────────────────────────────────────────────────────────────────────────────+ | |
| Routing policy | The desired routing policy is the default. So no value is needed in the SAM template | | |
+─────────────────────────+───────────────────────────────────────────────────────────────────────────────────────+ | |
| Record name | Name | | |
+─────────────────────────+───────────────────────────────────────────────────────────────────────────────────────+ | |
| Alias | AliasTarget | | |
+─────────────────────────+───────────────────────────────────────────────────────────────────── |
NewerOlder