Skip to content

Commit

Permalink
Update lambda configuration and chunk size
Browse files Browse the repository at this point in the history
  • Loading branch information
FloRul committed Feb 16, 2024
1 parent c1955b0 commit 5a7ee3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lambdas/inference/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ module "lambda_function_container_image" {
ENABLE_RETRIEVAL = 1
MEMORY_LAMBDA_NAME = var.memory_lambda_name
DYNAMO_TABLE = var.dynamo_history_table_name
TOP_K = 50
TEMPERATURE = 0.5
TOP_K = 10
TEMPERATURE = 0.1
TOP_P = 0.99
RELEVANCE_THRESHOLD = 0.65
RELEVANCE_THRESHOLD = 0.67
MODEL_ID = "anthropic.claude-instant-v1"
EMBEDDING_COLLECTION_NAME = var.embedding_collection_name
SYSTEM_PROMPT = "Answer in four to five sentences maximum.Answer in french."
Expand Down
3 changes: 2 additions & 1 deletion lambdas/ingestion/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ module "lambda_function_container_image" {
PGVECTOR_DATABASE = var.pg_vector_database
PGVECTOR_USER = var.pg_vector_user
PGVECTOR_PASSWORD_SECRET_NAME = var.pg_vector_password_secret_name
USE_TEXTRACT = 0
CHUNK_SIZE = 256
CHUNK_OVERLAP = 20
}
policy_statements = {
log_group = {
Expand Down
4 changes: 3 additions & 1 deletion lambdas/ingestion/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def get_secret():
PGVECTOR_PORT = int(os.environ.get("PGVECTOR_PORT", 5432))
PGVECTOR_DATABASE = os.environ.get("PGVECTOR_DATABASE", "postgres")
PGVECTOR_USER = os.environ.get("PGVECTOR_USER", "postgres")
CHUNK_SIZE = int(os.environ.get("CHUNK_SIZE", 256))
CHUNK_OVERLAP = int(os.environ.get("CHUNK_OVERLAP", 20))
PGVECTOR_PASSWORD = get_secret()


Expand Down Expand Up @@ -100,7 +102,7 @@ def extract_pdf_content(file_path, file_name):

loader = PyPDFLoader(file_path)
docs = loader.load_and_split(
text_splitter=RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=50)
text_splitter=RecursiveCharacterTextSplitter(chunk_size=CHUNK_SIZE, chunk_overlap=CHUNK_OVERLAP)
)
created_at = datetime.datetime.now().isoformat()
for doc in docs:
Expand Down

0 comments on commit 5a7ee3d

Please sign in to comment.