Skip to content

Commit 8adc7c4

Browse files
committed
refactor: refactor packaging script
1 parent 240433b commit 8adc7c4

File tree

13 files changed

+542
-103
lines changed

13 files changed

+542
-103
lines changed

.pylintrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[MASTER]
2-
ignore =
3-
__version__.py
2+
ignore-paths=venv,node_modules
3+
ignore=__version__.py
44

55
[FORMAT]
66
max-line-length=120
7+
8+
[MESSAGES CONTROL]
9+
disable=too-few-public-methods,invalid-name,line-too-long,no-self-argument,unused-import

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Detailed documentation for each endpoint is available here: [Documentation](./do
102102

103103
## Support
104104

105-
To get community support, go to the official [Issues Page](https://github.com/FullStackWithLawrence/aws-rekognition/issues) for this project.
105+
To get community support, go to the official [Issues Page](https://github.com/FullStackWithLawrence/aws-openai/issues) for this project.
106106

107107
## Good Coding Best Practices
108108

api/terraform/json/iam_policy_lambda.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
"logs:FilterLogEvents"
1414
],
1515
"Resource": ["arn:aws:lambda:*"]
16+
},
17+
{
18+
"Effect": "Allow",
19+
"Action": [
20+
"apigateway:GET",
21+
"iam:ListPolicies",
22+
"iam:GetPolicy",
23+
"iam:GetPolicyVersion",
24+
"iam:ListAttachedRolePolicies",
25+
"s3:ListAllMyBuckets",
26+
"ec2:DescribeRegions",
27+
"route53:ListHostedZones",
28+
"route53:ListResourceRecordSets"
29+
],
30+
"Resource": "*"
1631
}
1732
]
1833
}

api/terraform/python/layer_genai/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ pinecone-client==2.2.4
1515
pydantic==2.5.3
1616
pydantic-settings==2.1.0
1717
python-dotenv==1.0.0
18+
python-hcl2==4.3.2

api/terraform/python/openai_api/common/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def parse_request(request_body: dict):
146146
model = request_body.get("model")
147147
messages = request_body.get("messages")
148148
input_text = request_body.get("input_text")
149-
temperature = request_body.get("temperature")
149+
temperature = request_body.get("temperature", -1)
150150
max_tokens = request_body.get("max_tokens")
151151
chat_history = request_body.get("chat_history")
152152

@@ -158,7 +158,7 @@ def parse_request(request_body: dict):
158158
logging.warning("model key not found in request body. defaulting to gpt-3.5-turbo")
159159
model = "gpt-3.5-turbo"
160160

161-
if not temperature:
161+
if temperature < 0:
162162
logging.warning("temperature key not found in request body. defaulting to 0.5")
163163
temperature = 0.5
164164

api/terraform/python/openai_api/lambda_langchain/tests/mock_data/json/cloudwatch_dump.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
"dotenv": [
1313
"AWS_REGION",
1414
"DEBUG_MODE",
15-
"AWS_DYNAMODB_TABLE_ID",
16-
"AWS_REKOGNITION_FACE_DETECT_MAX_FACES_COUNT",
17-
"AWS_REKOGNITION_FACE_DETECT_THRESHOLD",
18-
"AWS_REKOGNITION_FACE_DETECT_ATTRIBUTES",
19-
"AWS_REKOGNITION_FACE_DETECT_QUALITY_FILTER",
20-
"AWS_REKOGNITION_COLLECTION_ID",
2115
"LANGCHAIN_MEMORY_KEY",
2216
"OPENAI_ENDPOINT_IMAGE_N",
2317
"OPENAI_ENDPOINT_IMAGE_SIZE"
@@ -46,9 +40,9 @@
4640
"throttle_settings_rate_limit"
4741
]
4842
},
49-
"aws_api_gateway": {
43+
"aws_apigateway": {
5044
"aws_apigateway_root_domain": "lawrencemcdaniel.com",
51-
"aws_apigateway_custom_domain_name_create": true,
45+
"aws_apigateway_create_custom_domaim": true,
5246
"aws_apigateway_custom_domain_name": "api.openai.lawrencemcdaniel.com"
5347
},
5448
"openai_api": {

api/terraform/python/openai_api/lambda_openai_v2/tests/mock_data/json/cloudwatch_dump.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
"dotenv": [
1313
"AWS_REGION",
1414
"DEBUG_MODE",
15-
"AWS_DYNAMODB_TABLE_ID",
16-
"AWS_REKOGNITION_FACE_DETECT_MAX_FACES_COUNT",
17-
"AWS_REKOGNITION_FACE_DETECT_THRESHOLD",
18-
"AWS_REKOGNITION_FACE_DETECT_ATTRIBUTES",
19-
"AWS_REKOGNITION_FACE_DETECT_QUALITY_FILTER",
20-
"AWS_REKOGNITION_COLLECTION_ID",
2115
"LANGCHAIN_MEMORY_KEY",
2216
"OPENAI_ENDPOINT_IMAGE_N",
2317
"OPENAI_ENDPOINT_IMAGE_SIZE"
@@ -46,9 +40,9 @@
4640
"throttle_settings_rate_limit"
4741
]
4842
},
49-
"aws_api_gateway": {
43+
"aws_apigateway": {
5044
"aws_apigateway_root_domain": "lawrencemcdaniel.com",
51-
"aws_apigateway_custom_domain_name_create": true,
45+
"aws_apigateway_create_custom_domaim": true,
5246
"aws_apigateway_custom_domain_name": "api.openai.lawrencemcdaniel.com"
5347
},
5448
"openai_api": {

codespell.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# this is a pypi package
2+
astroid
13
# 'broked' is an intentionally misspelled word used as an example
24
# in the "Grammar Genius" sample app.
35
broked

doc/GOOD_CODING_PRACTICE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Of note:
1010

1111
- [Automated Pull Requests](https://github.com/FullStackWithLawrence/aws-openai/pulls?q=is%3Apr+is%3Aclosed): Github Actions are triggered on pull requests to run any of several different kinds of technology-specific unit tests depending on the contents of the commits included in the PR.
1212
- [python-dotenv](https://pypi.org/project/python-dotenv/) for storing sensitive data for local development
13-
- [Pydantic](https://docs.pydantic.dev/latest/) is the most widely used data validation library for Python. We use it for the [Settings](../terraform/python/rekognition_api/conf.py) class in this project. It's an important addition because it enforces strong type and business rule validation checking of all of the configuration parameters for the AWS Rekognition service, and it ensures that nothing ever changes these values at run-time once they've been set. And this in turn is important because erroneous automation code could otherwise lead to some wildly disastrous results. 😳
13+
- [Pydantic](https://docs.pydantic.dev/latest/) is the most widely used data validation library for Python. We use it for the [Settings](../api/terraform/python/openai_api/common/conf.py) class in this project. It's an important addition because it enforces strong type and business rule validation checking of all of the configuration parameters for the AWS Lambdas, and it ensures that nothing ever changes these values at run-time once they've been set. And this in turn is important because erroneous automation code could otherwise lead to some wildly disastrous results. 😳
1414
- [.gitignore](./.gitignore) ensures that no sensitive nor useless data accidentally gets pushed to GitHub.
1515
- [tox.ini](./tox.ini) file for configuring behaviors of Python testing tools
1616
- [GitHub Actions](https://github.com/features/actions) automates unit testing, semantic release rule checking, and dependabot actions.

doc/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
- **[Certificate Manager](https://aws.amazon.com/certificate-manager/)**: handles the complexity of creating, storing, and renewing public and private SSL/TLS X.509 certificates and keys that protect your AWS websites and applications.
1010
- **[Route53](https://aws.amazon.com/route53/)**: a scalable and highly available Domain Name System service. Released on December 5, 2010.
1111
- **[CloudWatch](https://aws.amazon.com/cloudwatch/)**: CloudWatch enables you to monitor your complete stack (applications, infrastructure, network, and services) and use alarms, logs, and events data to take automated actions and reduce mean time to resolution (MTTR).
12-
- **[Rekognition](https://aws.amazon.com/rekognition/)**: (FOR FUTURE USE) a cloud-based software as a service computer vision platform that was launched in 2016. It is an AWS managed Machine Learning Service with Content moderation, Face compare and search, Face Detection and analysis, Labeling, Custom labels, Text detection, Celebrity recognition, Video segment detection and Streaming Video Events detection features. It is used by a number of United States government agencies, including U.S. Immigration and Customs Enforcement and Orlando, Florida police, as well as private entities.
13-
- **[DynamoDB](https://aws.amazon.com/dynamodb/)**: (FOR FUTURE USE) a fully managed proprietary NoSQL database offered by Amazon.com as part of the Amazon Web Services portfolio. DynamoDB offers a fast persistent Key-Value Datastore with built-in support for replication, autoscaling, encryption at rest, and on-demand backup among other features.
1412

1513
## Lambda Functions
1614

0 commit comments

Comments
 (0)