From b67a5ed7be3e89aca5436a108047f7a158633b76 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Sun, 1 Sep 2024 10:18:53 -0700 Subject: [PATCH] Try using 3.11 --- aws/ai/.tool-versions | 2 +- aws/ai/poetry.lock | 34 ++-------------------------------- aws/ai/pyproject.toml | 11 ++++++----- aws/ai/serverless.yml | 10 ++++++---- 4 files changed, 15 insertions(+), 42 deletions(-) diff --git a/aws/ai/.tool-versions b/aws/ai/.tool-versions index c8c54490..99e9090a 100644 --- a/aws/ai/.tool-versions +++ b/aws/ai/.tool-versions @@ -1,2 +1,2 @@ -python 3.10.14 +python 3.11.9 nodejs 20.13.1 diff --git a/aws/ai/poetry.lock b/aws/ai/poetry.lock index 21e38914..8032446d 100644 --- a/aws/ai/poetry.lock +++ b/aws/ai/poetry.lock @@ -12,10 +12,8 @@ files = [ ] [package.dependencies] -exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" sniffio = ">=1.1" -typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] @@ -187,20 +185,6 @@ files = [ {file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"}, ] -[[package]] -name = "exceptiongroup" -version = "1.1.2" -description = "Backport of PEP 654 (exception groups)" -optional = false -python-versions = ">=3.7" -files = [ - {file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"}, - {file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"}, -] - -[package.extras] -test = ["pytest (>=6)"] - [[package]] name = "fastjsonschema" version = "2.17.1" @@ -494,7 +478,6 @@ files = [ [package.dependencies] numpy = [ - {version = ">=1.22.4", markers = "python_version < \"3.11\""}, {version = ">=1.23.2", markers = "python_version == \"3.11\""}, {version = ">=1.26.0", markers = "python_version >= \"3.12\""}, ] @@ -644,11 +627,9 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} -exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] @@ -795,17 +776,6 @@ files = [ doc = ["reno", "sphinx"] test = ["pytest", "tornado (>=4.5)", "typeguard"] -[[package]] -name = "tomli" -version = "2.0.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, -] - [[package]] name = "tqdm" version = "4.65.0" @@ -989,5 +959,5 @@ files = [ [metadata] lock-version = "2.0" -python-versions = "^3.10" -content-hash = "148ec32f380ab8016b78287dd922615fe89baabe48d5de1e8075f1948e47195e" +python-versions = "^3.11" +content-hash = "3449e1406f703bdc3cd9c7728578c51081ec19275a7a412a835103552c16bda4" diff --git a/aws/ai/pyproject.toml b/aws/ai/pyproject.toml index 19d967ba..8142dd70 100644 --- a/aws/ai/pyproject.toml +++ b/aws/ai/pyproject.toml @@ -6,15 +6,16 @@ authors = ["Sawyer "] package-mode = false [tool.poetry.dependencies] -python = "^3.10" +python = "^3.11" openai = "^1.43.0" tenacity = "^8.2.2" +jiter = "^0.5.0" [tool.poetry.group.dev.dependencies] -aws-lambda-powertools = {extras = ["all"], version = "^2.19.0"} # included in Lambda layer -awswrangler = "^3.2.1" # included in Lambda layer -numpy = "^1.25.0" # included in Lambda layer -pandas = "^2.0.3" # included in Lambda layer +aws-lambda-powertools = {extras = ["all"], version = "^2.43.1"} # included in Lambda layer +awswrangler = "^3.9.1" # included in Lambda layer +numpy = "^1.26.4" # included in Lambda layer +pandas = "^2.2.2" # included in Lambda layer openai = { version = "^1.43.0", extras = ["embeddings"] } # not using embeddings utils in Lambda code pytest = "^7.4.0" pytest-watch = "^4.2.0" diff --git a/aws/ai/serverless.yml b/aws/ai/serverless.yml index c0cbfdbb..5c40e9aa 100644 --- a/aws/ai/serverless.yml +++ b/aws/ai/serverless.yml @@ -5,8 +5,10 @@ frameworkVersion: "3" provider: name: aws - runtime: python3.10 - architecture: x86_64 + runtime: python3.11 + # "...significantly better price and performance" + # https://docs.aws.amazon.com/lambda/latest/dg/foundation-arch.html#foundation-arch-adv + architecture: arm64 # "faster and have no downsides (unless you specifically use the generated change sets). # They will become the default in Serverless Framework 4." deploymentMethod: direct @@ -41,9 +43,9 @@ functions: layers: - !Ref PythonRequirementsLambdaLayer # https://aws-sdk-pandas.readthedocs.io/en/stable/layers.html - - arn:aws:lambda:${aws:region}:336392948345:layer:AWSSDKPandas-Python310:20 + - arn:aws:lambda:${aws:region}:336392948345:layer:AWSSDKPandas-Python311-Arm64:17 # https://docs.powertools.aws.dev/lambda/python/latest/ - - arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:79 + - arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:79 environment: EMBEDDINGS_S3_BUCKET: highlights.sawyerh.com EMBEDDINGS_S3_KEY: ai/embeddings.parquet