Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.
[Brief description ]
- [more description]
- [more description]
- [more description]
# Supply a custom prompt to a LangChain QA Chain | |
system_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. | |
{context} | |
Question: {question} | |
Helpful Answer:""" | |
messages = [ | |
SystemMessagePromptTemplate.from_template(system_template), | |
HumanMessagePromptTemplate.from_template("{question}"), |
import boto3 | |
# This code deletes buckets on AWS S3. | |
# It is designed to be run on a local machine with credentials for an AWS account that has the | |
# necessary permissions to delete buckets. | |
# It will delete the contents of the buckets before deleting the bucket itself. | |
# It will not attempt to delete a bucket that does not exist. | |
# BUCKETS is a list of bucket names that should be deleted. If a bucket in the list does not | |
# exist, it will be skipped. |
""" | |
Usage example: | |
from logger import get_logger | |
log = get_logger() | |
log.info('my_event', my_key1='val 1', my_key2=5, my_key3=[1, 2, 3], my_key4={'a': 1, 'b': 2}) | |
List of metadata keys in each log message: | |
event | |
_func |
Ec2InPrivateSubnetWithouttNatGtwy: | |
Type: AWS::EC2::Instance | |
Properties: | |
ImageId: !Ref LatestAmiId | |
InstanceType: !Ref InstanceType | |
# KeyName: NO SSH Key needed | |
IamInstanceProfile: !Ref Ec2InstanceProfile | |
NetworkInterfaces: | |
# The SSM Agent running on the EC2 instances must be able to connect to Session Manager's | |
# public endpoint. You can also set up a PrivateLink connection to allow instances running |
env: | |
variables: | |
LAMBDA_PKG_BUCKET_PREFIX: mia | |
phases: | |
install: | |
commands: |
# replace json_api value with parsed value | |
for key in json_encoded_key_names: | |
if key in pdp_output.get('product-attributes') and pdp_output['product-attributes'][key] is not None: | |
try: | |
pdp_output['product-attributes'][key] = json.loads(pdp_output['product-attributes'][key]) | |
except json.decoder.JSONDecodeError as e: | |
record_fault('call-resp-processing.atg.missing-required-data', | |
f"""Invalid JSON: {key} in pdp_output['product-attributes'] Reason: | |
{e.msg} Data: {pdp_output['product-attributes'][key]}""") |
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "VPC Across 3 AZs", | |
"Parameters": { | |
"EnvName": { | |
"Type": "String", | |
"Default": "Dev", | |
"AllowedValues": [ | |
"Dev", "Test", "Prod" | |
], |
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "VPC Across 3 AZs", | |
"Parameters": { | |
"EnvName": { | |
"Type": "String", | |
"Default": "Dev", | |
"AllowedValues": [ | |
"Dev", "Test", "Prod" | |
], |
#!/usr/bin/env python | |
''' | |
Send memory usage metrics to Amazon CloudWatch | |
This is intended to run on an Amazon EC2 instance and requires an IAM | |
role allowing to write CloudWatch metrics. Alternatively, you can create | |
a boto credentials file and rely on it instead. | |
Original idea based on https://github.com/colinbjohnson/aws-missing-tools |