Merged in feature/llm_lambda_uat (pull request #199)
Feature/llm lambda uat Approved-by: Umang Mistry
This commit is contained in:
@@ -20,7 +20,7 @@ BEDROCK_REGION = "us-east-1"
|
||||
SNOWFLAKE_SCHEMA = "STG"
|
||||
MAX_PROMPT_LENGTH_PER_GROUP = 20000 # Adjust as needed
|
||||
LLM_SELECTED = "Claude 3 - Sonnet"
|
||||
SNOWFLAKE_CONN_SECRET_NAME = "doczy_dev_db_creds"
|
||||
SNOWFLAKE_CONN_SECRET_NAME = "doczy-dev-db-svc-acc"
|
||||
|
||||
# Get variable ENVIRONMENT from env variables using os
|
||||
env = os.environ.get('ENVIRONMENT')
|
||||
@@ -70,8 +70,8 @@ sf_secrets = json.loads(get_secret())
|
||||
snowflake_conn = snowflake.connector.connect(
|
||||
user=sf_secrets.get('user'),
|
||||
password=sf_secrets.get('password'),
|
||||
account=sf_secrets.get('account_alias'),
|
||||
role=sf_secrets.get('ROLE'),
|
||||
account=sf_secrets.get('account_locator'),
|
||||
role=sf_secrets.get('role'),
|
||||
warehouse=sf_secrets.get('warehouse'),
|
||||
database=sf_secrets.get('database'),
|
||||
schema=SNOWFLAKE_SCHEMA
|
||||
@@ -132,6 +132,8 @@ def lambda_handler(event, context):
|
||||
# Process each message from the SQS event
|
||||
for record in records['Records']:
|
||||
# Extract the message body from the record
|
||||
logger.info(f"RECORD:: {record}")
|
||||
|
||||
sqs_record = record['s3']
|
||||
bucket_name = sqs_record['bucket']['name']
|
||||
object_key = unquote_plus(sqs_record['object']['key'])
|
||||
@@ -494,7 +496,7 @@ def main(bucket, object_key, field_groups):
|
||||
|
||||
question = prepare_prompt(*field_groups)
|
||||
response_text = invoke_llm(context, question, llm_selected=LLM_SELECTED)
|
||||
logger.info(f"Response text: {response_text}, CONTEXT: {context}")
|
||||
# logger.info(f"Response text: {response_text}, CONTEXT: {context}")
|
||||
field_l, answer_l, page_no_l, location_l, snippet_l = json_parsing(response_text, context)
|
||||
field_list.extend(field_l)
|
||||
answer_list.extend(answer_l)
|
||||
|
||||
@@ -649,13 +649,14 @@ module "prompt_orchestrator_lambda_function" {
|
||||
|
||||
layers = [
|
||||
module.anthropic_sf_lambda_layer.lambda_layer_arn,
|
||||
# module.pandas_numpy_lambda_layer.lambda_layer_arn,
|
||||
module.pydantic_lambda_layer.lambda_layer_arn,
|
||||
var.pandas_numpy_lambda_layer_additional_arn
|
||||
]
|
||||
|
||||
environment_variables = merge(local.environment_variables, local.prompt_orchestrator_lambda.environment_variables, {
|
||||
PROMPT_PROCESSOR_QUEUE_URL = var.prompt_processor_queue_url
|
||||
MAX_PROMPT_LENGTH_PER_GROUP = "5000"
|
||||
MAX_PROMPT_LENGTH_PER_GROUP = "50000"
|
||||
})
|
||||
|
||||
source_path = local.prompt_orchestrator_lambda.source_path
|
||||
|
||||
Reference in New Issue
Block a user