Skip to content

Commit 8d801c4

Browse files
committed
Merge branch 'main' into beta
2 parents 0c60256 + a2b2783 commit 8d801c4

45 files changed

Lines changed: 258 additions & 599 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
default_language_version:
22
# default language version for each language
3-
python: python3.11
3+
python: python3.13
44
repos:
55
- repo: https://github.com/codespell-project/codespell
66
rev: v2.4.1

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ifeq ($(OS),Windows_NT)
66
PYTHON := python.exe
77
ACTIVATE_VENV := venv\Scripts\activate
88
else
9-
PYTHON := python3.11
9+
PYTHON := python3.13
1010
ACTIVATE_VENV := source venv/bin/activate
1111
endif
1212
PIP := $(PYTHON) -m pip

api/terraform/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM public.ecr.aws/lambda/python:3.13
2+
3+
RUN pip install --no-cache-dir --upgrade pip
4+
5+
COPY requirements.txt .
6+
RUN pip install --no-cache-dir -r requirements.txt
7+
8+
COPY python/ /var/task/
9+
10+
CMD ["openai_api.lambda_openai_v2.lambda_handler.handler"]

api/terraform/ecr_lambda_repo.tf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#------------------------------------------------------------------------------
2+
# written by: Lawrence McDaniel
3+
# https://lawrencemcdaniel.com/
4+
#
5+
# date: sep-2023
6+
#
7+
# usage: Build a one-size-fits-all ECR repository to hold the
8+
# Lambda function container image.
9+
#------------------------------------------------------------------------------
10+
locals {
11+
image_tag = "v1.0.7"
12+
}
13+
14+
15+
16+
resource "null_resource" "build_and_push" {
17+
triggers = {
18+
dockerfile = filesha1("${path.module}/Dockerfile")
19+
requirements = filesha1("${path.module}/requirements.txt")
20+
source_hash = sha1(join("", [for f in fileset("${path.module}/python/openai_api", "**") : filesha1("${path.module}/python/openai_api/${f}")]))
21+
}
22+
provisioner "local-exec" {
23+
interpreter = ["/bin/bash", "-c"]
24+
25+
command = <<EOT
26+
set -e
27+
28+
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
29+
REGION=${var.aws_region}
30+
REPO=${aws_ecr_repository.lambda_repo.name}
31+
32+
IMAGE_URI=$AWS_ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$REPO:${local.image_tag}
33+
34+
aws ecr get-login-password --region $REGION \
35+
| docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com
36+
37+
38+
docker build --platform linux/amd64 -t $REPO:${local.image_tag} .
39+
docker tag $REPO:${local.image_tag} $IMAGE_URI
40+
docker push $IMAGE_URI
41+
42+
EOT
43+
}
44+
}
45+
46+
resource "aws_ecr_repository" "lambda_repo" {
47+
name = "lambda-openai-v2"
48+
}

api/terraform/lambda_info.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ resource "aws_lambda_function" "info" {
7272
handler = "openai_api.lambda_info.lambda_handler.handler"
7373
filename = data.archive_file.lambda_info.output_path
7474
source_code_hash = data.archive_file.lambda_info.output_base64sha256
75-
layers = [aws_lambda_layer_version.openai.arn]
7675
tags = var.tags
7776

7877
environment {

api/terraform/lambda_langchain.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ resource "aws_lambda_function" "lambda_langchain" {
7979
architectures = var.compatible_architectures
8080
filename = data.archive_file.lambda_langchain.output_path
8181
source_code_hash = data.archive_file.lambda_langchain.output_base64sha256
82-
layers = [aws_lambda_layer_version.openai.arn, aws_lambda_layer_version.langchain.arn]
8382
tags = var.tags
8483

8584
environment {

api/terraform/lambda_layer_langchain.tf

Lines changed: 0 additions & 62 deletions
This file was deleted.

api/terraform/lambda_layer_nlp.tf

Lines changed: 0 additions & 62 deletions
This file was deleted.

api/terraform/lambda_layer_openai.tf

Lines changed: 0 additions & 62 deletions
This file was deleted.

api/terraform/lambda_layer_pandas.tf

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)