Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions layer/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Sample file built from bedrock-access-gateway repo
fastapi==0.115.6
pydantic==2.10.4
uvicorn==0.34.0
requests==2.32.3
boto3==1.38.27
botocore==1.38.27
fastapi==0.120.0
pydantic==2.12.3
pydantic-settings==2.11.0
uvicorn==0.29.0
tiktoken==0.6.0
numpy==1.26.4
boto3==1.40.59
botocore==1.40.59
16 changes: 12 additions & 4 deletions patches/app.py.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
--- a/api/app.py
+++ b/api/app.py
@@ -6,7 +6,6 @@ from fastapi.responses import StreamingResponse
@@ -5,7 +5,6 @@ from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError
from fastapi.middleware.cors import CORSMiddleware
from fastapi.openapi.docs import get_swagger_ui_html
from fastapi.staticfiles import StaticFiles
from fastapi.responses import PlainTextResponse
-from mangum import Mangum

from api.routers import chat, embeddings, model
from api.setting import (
from api.setting import API_ROUTE_PREFIX, DESCRIPTION, SUMMARY, TITLE, VERSION
@@ -47,7 +46,5 @@ async def validation_exception_handler(request, exc):
return PlainTextResponse(str(exc), status_code=400)


-handler = Mangum(app)
-
if __name__ == "__main__":
uvicorn.run("app:app", host="0.0.0.0", port=8000, reload=True)
12 changes: 6 additions & 6 deletions patches/pydantic-version.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
mangum==0.19.0
fastapi==0.115.6
-pydantic==2.10.4
+pydantic>=2.10.4
pydantic-settings==2.6.1
uvicorn==0.34.0
fastapi==0.115.8
-pydantic==2.7.1
+pydantic>=2.12.3
uvicorn==0.29.0
mangum==0.17.0
tiktoken==0.6.0
18 changes: 13 additions & 5 deletions patches/requirements.txt.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,3 @@
-mangum==0.19.0
fastapi==0.115.6
pydantic==2.10.4
pydantic-settings==2.6.1
@@ -1,9 +1,8 @@
-fastapi==0.115.8
-pydantic==2.7.1
+fastapi==0.120.0
+pydantic==2.12.3
+pydantic-settings==2.11.0
uvicorn==0.29.0
-mangum==0.17.0
tiktoken==0.6.0
-requests==2.32.3
numpy==1.26.4
boto3==1.37.0
botocore==1.37.0
15 changes: 7 additions & 8 deletions prepare_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,29 @@ rm -rf app/api
rm -f layer/requirements.txt

if [ -d "$REPO_DIR" ]; then
echo "Repository already cloned, fetching latest changes"
(cd $REPO_DIR && git fetch)
echo "Repository already cloned, resetting to clean state"
(cd $REPO_DIR && git reset --hard HEAD && git clean -fd)
else
echo "Cloning aws-samples/bedrock-access-gateway repository"
git clone --depth 1 https://github.com/aws-samples/bedrock-access-gateway $REPO_DIR
fi

cp -r $REPO_DIR/src/api app/api
cp $REPO_DIR/src/requirements.txt layer/requirements.txt

echo "" > app/requirements.txt

# Apply patches
echo "Applying patches"
(cd $REPO_DIR/src && patch -p1 < ../../../patches/auth.py.patch)
(cd $REPO_DIR/src && patch -p1 < ../../../patches/app.py.patch)
(cd $REPO_DIR/src && patch -p1 < ../../../patches/requirements.txt.patch)
(cd $REPO_DIR/src && patch -p1 < ../../../patches/pydantic-version.patch)

if [ "$NO_EMBEDDINGS" = true ]; then
echo "Applying no-embeddings patch"
(cd $REPO_DIR/src && patch -p1 < ../../../patches/no-embeddings.patch)
fi

cp -r $REPO_DIR/src/api app/api
cp $REPO_DIR/src/requirements.txt layer/requirements.txt

echo "" > app/requirements.txt

# Update boto3/botocore to latest versions
for pkg in boto3 botocore; do
VERSION=$(pip index versions $pkg 2>/dev/null | grep -m 1 "LATEST: " | awk '{print $2}')
Expand Down