Zack Saadioui
8/26/2024
1
2
bash
pip install llama-index
1
ml.g5.2xlarge
1
2
bash
pip install boto3
1
ml.t3.medium
1
2
3
python
from llama_index import LlamaIndex
from sagemaker import get_execution_role
1
2
3
4
5
6
7
8
9
python
import boto3
role = get_execution_role()
runtime = boto3.Session().client('runtime.sagemaker')
response = runtime.invoke_endpoint(
EndpointName='YOUR_ENDPOINT_NAME',
ContentType='application/json',
Body=json.dumps(data)
)
1
YOUR_ENDPOINT_NAME
1
2
3
python
from llama_index import VectorStoreIndex
index = VectorStoreIndex.from_documents(documents)
1
2
python
indexes.create_index(type='simple') # Build a simple index
1
2
3
python
s3 = boto3.client('s3')
s3.upload_file('YOUR_FILE', 'YOUR_BUCKET', 'S3_OBJECT_NAME')
1
2
3
4
5
6
python
from aws_lambda_powertools import Logger
logger = Logger()
@logger.inject_lambda_context
def lambda_handler(event, context):
# Code to process incoming data
1
ml.g4dn.xlarge
Copyright © Arsturn 2024