in skills/contextual-embeddings/contextual-rag-lambda-function/s3_adapter.py [0:0]
def read_from_s3(self, bucket_name, file_name):
"""
Write a JSON object to an S3 bucket
:param bucket_name: Name of the S3 bucket
:param file_name: Name of the file to be created in the bucket
:return: True if file was uploaded, else False
"""
try:
# Get the object from S3
response = self.s3_client.get_object(Bucket=bucket_name, Key=file_name)
# Read the content of the file
return json.loads(response['Body'].read().decode('utf-8'))
except ClientError as e:
print(f"Error reading file from S3: {str(e)}")