Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d24c999
Add identifier to IIIF manifests
kdid Feb 6, 2025
fc7029e
Merge pull request #280 from nulib/5347-identifier
kdid Feb 6, 2025
bbcf04e
Update av download lambda to node 22.x and AWS SDK v3
kdid Feb 10, 2025
5d9fbc6
Update hybrid search boosts
kdid Feb 14, 2025
400aa93
Merge pull request #284 from nulib/5395-hybrid-boost
kdid Feb 14, 2025
50760e1
Fix bugs in size param with IIIF collection requests
kdid Feb 21, 2025
b210f40
Require IAM role to access chat sync function
kdid Feb 21, 2025
cfc551b
Merge pull request #285 from nulib/5423-chat-sync
kdid Feb 21, 2025
27f8470
Update tests that make use of `defaultSearchSize()` to make sure the …
mbklein Feb 21, 2025
0dcfe65
Change default value in template to string
kdid Feb 21, 2025
85128bb
Merge pull request #286 from nulib/5368-size-attempt2
kdid Feb 24, 2025
10af1b4
Don't list default search size as parameter in SAM template
kdid Feb 24, 2025
71af051
Merge pull request #287 from nulib/fix-default-search-size
kdid Feb 24, 2025
80d3af3
Merge pull request #282 from nulib/5331-update-av-download
kdid Feb 24, 2025
b70e620
Fix search size parameter in collection searches
kdid Feb 25, 2025
d913041
Merge pull request #288 from nulib/fix-collection-search-size
kdid Feb 25, 2025
e864524
Fix bug with duplicated size in next page url of IIIF collection result
kdid Feb 25, 2025
a3d97ba
Merge pull request #289 from nulib/fix-collection-search-size-again
kdid Feb 25, 2025
3f3650f
Add group_with to OpenAPI schema (#295)
kdid Mar 13, 2025
ecd33f6
Implement IIIF choice based on group_with field
kdid Mar 12, 2025
16442fa
Merge pull request #297 from nulib/5444-iiif-choice
kdid Mar 14, 2025
45d9e2d
Try using nodejs18.x for startAudioTranscodeFunction
mbklein Mar 17, 2025
c28dc9e
Use @aws-sdk/lib-storage for audio file upload
mbklein Mar 18, 2025
27164b1
Merge pull request #300 from nulib/5452-fix-audio-transcode
mbklein Mar 18, 2025
9909333
Read OpenSearch and Azure OpenAI configs from Secrets Manager
mbklein Nov 7, 2024
137fb3f
Begin to add LangGraph agent code
mbklein Dec 4, 2024
e7766b4
Switch from Azure OpenAI to Bedrock
mbklein Dec 12, 2024
9b8bb34
Move delete_checkpoints to the s3 checkpointer
mbklein Dec 12, 2024
4ede5c7
Add metrics-gathering callback handler
mbklein Dec 13, 2024
fe7d5b8
Update tests
Dec 16, 2024
6f938a3
Update chat README with information about Websockets and authentication
bmquinn Feb 13, 2025
3e75e5f
Add filter to aggregation searches, new notebook for OpenSearch
bmquinn Feb 28, 2025
3f0a499
Limit tool calling recursion in agent and address unclear questions
kdid Mar 7, 2025
544d219
Chat conversations add docs to context
kdid Mar 10, 2025
da13d88
Add selective checkpointer
mbklein Mar 12, 2025
05d9ab4
Change how message filtering happens
mbklein Mar 13, 2025
0f4eba4
Update feedback validation and naming
Mar 14, 2025
8f2771d
Up recursion limit to 12 for now
kdid Mar 14, 2025
9d9a598
Fix recursion limit error on followup question
Mar 20, 2025
1d9aeb1
Refactor project structure into sub-stacks
mbklein Feb 14, 2025
42ffa96
Let tools return just content instead of content and artifact
mbklein Mar 20, 2025
99d17a2
Move metrics logging to the MetricsCallbackHandler
mbklein Mar 21, 2025
cfd2d13
Save tokens by filtering fields in documents returned from index.
mbklein Mar 24, 2025
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: 6 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ jobs:
contents: read
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}
steps:
- name: Set CONFIG_ENV from Branch Name
- name: Set DEPLOY_ENV from Branch Name
run: |
if [[ $BRANCH == 'refs/heads/main' ]]; then
echo "CONFIG_ENV=production" >> $GITHUB_ENV
echo "DEPLOY_ENV=production" >> $GITHUB_ENV
else
echo "CONFIG_ENV=$(echo $BRANCH | awk -F/ '{print $NF}')" >> $GITHUB_ENV
echo "DEPLOY_ENV=$(echo $BRANCH | awk -F/ '{print $NF}')" >> $GITHUB_ENV
fi
env:
BRANCH: ${{ github.ref }}
- name: Confirm deploy environment
run: echo "Deploying to '$CONFIG_ENV' environment"
run: echo "Deploying to '$DEPLOY_ENV' environment"
- name: Set GitHub Deploy Key
uses: webfactory/ssh-agent@v0.5.3
with:
Expand All @@ -49,16 +49,13 @@ jobs:
with:
role-to-assume: arn:aws:iam::${{ secrets.AwsAccount }}:role/github-actions-role
aws-region: us-east-1
- run: ln -s .tfvars/dc-api/samconfig.toml .
- run: ln -s .tfvars/dc-api/$CONFIG_ENV.parameters .
- run: ln -s .tfvars/dc-api/samconfig.${DEPLOY_ENV}.yaml .
- run: make build
- run: |
sam deploy \
--no-confirm-changeset \
--no-fail-on-empty-changeset \
--config-env $CONFIG_ENV \
--config-file ./samconfig.toml \
--parameter-overrides $(while IFS='=' read -r key value; do params+=" $key=$value"; done < ./$CONFIG_ENV.parameters && echo "$params HoneybadgerRevision=$HONEYBADGER_REVISION") \
--config-file ./samconfig.${DEPLOY_ENV}.yaml \
| sed 's/\(Parameter overrides\s*\): .*/\1: ***** REDACTED *****/'
exit ${PIPESTATUS[0]}
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ on:
push:
paths:
- ".github/workflows/test-node.yml"
- "node/**"
- "api/**"
workflow_dispatch:
defaults:
run:
working-directory: ./node
working-directory: ./api
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -20,7 +20,7 @@ jobs:
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: 'node/package-lock.json'
cache-dependency-path: 'api/package-lock.json'
- run: npm ci
- name: Check code style
run: npm run lint && npm run prettier
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ci
AWS_SECRET_ACCESS_KEY: ci
SKIP_LLM_REQUEST: 'True'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -27,5 +26,7 @@ jobs:
run: ruff check .
- name: Run tests
run: |
coverage run --include='src/**/*' -m unittest
coverage run --include='src/**/*' -m pytest -m ""
coverage report
env:
AWS_REGION: us-east-1
8 changes: 5 additions & 3 deletions .github/workflows/validate-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install cfn-lint
run: pip install cfn-lint
- uses: aws-actions/setup-sam@v1
- name: sam fix https://github.com/aws/aws-sam-cli/issues/4527
run: $(dirname $(readlink $(which sam)))/pip install --force-reinstall "cryptography==38.0.4"
# - name: sam fix https://github.com/aws/aws-sam-cli/issues/4527
# run: $(dirname $(readlink $(which sam)))/pip install --force-reinstall "cryptography==38.0.4"
- uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: arn:aws:iam::${{ secrets.AwsAccount }}:role/github-actions-role
aws-region: us-east-1
- uses: actions/checkout@v3
- name: Validate template
run: sam build && sam validate
run: make build && make validate
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
cd node && npm run lint && npm run prettier && cd -
cd api && npm run lint && npm run prettier && cd -
cd chat/src && ruff check . && cd -
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nodejs 20.15.0
java corretto-19.0.1.10.1
aws-sam-cli 1.107.0
aws-sam-cli 1.135.0
python 3.12.2
143 changes: 95 additions & 48 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,88 +5,135 @@ ENV=dev
SHELL := /bin/bash

help:
echo "make build | build the SAM project"
echo "make serve | alias for serve-https"
echo "make clean | remove all installed dependencies and build artifacts"
echo "make deps | install all dependencies"
echo "make link | create hard links to allow for hot reloading of a built project"
echo "make secrets | symlink secrets files from ../tfvars"
echo "make start-with-step | run the SAM server locally with step function & download lambdas"
echo "make style | run all style checks"
echo "make test | run all tests"
echo "make cover | run all tests with coverage"
echo "make env ENV=[env] | activate env.\$$ENV.json file (default: dev)"
echo "make deps-node | install node dependencies"
echo "make deps-python | install python dependencies"
echo "make serve-http | run the SAM server locally (HTTP on port 3000)"
echo "make serve-https | run the SAM server locally (HTTPS on port 3002)"
echo "make style-node | run node code style check"
echo "make style-python | run python code style check"
echo "make test-node | run node tests"
echo "make test-python | run python tests"
echo "make cover-node | run node tests with coverage"
echo "make cover-python | run python tests with coverage"
.aws-sam/build.toml: ./template.yaml node/package-lock.json node/src/package-lock.json chat/dependencies/requirements.txt chat/src/requirements.txt
sed -Ei.orig 's/^(\s+)#\*\s/\1/' template.yaml
sed -Ei.orig 's/^(\s+)#\*\s/\1/' chat/template.yaml
sam build --cached --parallel
mv template.yaml.orig template.yaml
mv chat/template.yaml.orig chat/template.yaml
deps-node:
cd node/src ;\
echo "make build | build the SAM project"
echo "make serve | alias for serve-https"
echo "make clean | remove all installed dependencies and build artifacts"
echo "make deps | install all dependencies"
echo "make env.json | create an env.json file for the current user's environment"
echo "make link | create hard links to allow for hot reloading of a built project"
echo "make secrets | symlink secrets files from ../tfvars"
echo "make start-with-step | run the SAM server locally with step function & download lambdas"
echo "make style | run all style checks"
echo "make test | run all tests"
echo "make cover | run all tests with coverage"
echo "make env ENV=[env] | activate env.\$$ENV.json file (default: dev)"
echo "make deps-node | install node dependencies"
echo "make deps-python | install python dependencies"
echo "make samconfig.NAME.yaml" | create a user samconfig file for the specified username"
echo "make build | build the SAM project for deploying"
echo "make deploy | deploy the SAM project to AWS"
echo "make sync | sync the SAM project to AWS for quick development"
echo "make sync-code | sync the SAM project to AWS (code changes only)"
echo "make serve-http | run the SAM server locally (HTTP on port 3000)"
echo "make serve-https | run the SAM server locally (HTTPS on port 3002)"
echo "make style-node | run node code style check"
echo "make style-python | run python code style check"
echo "make test-node | run node tests"
echo "make test-python | run python tests"
echo "make cover-node | run node tests with coverage"
echo "make cover-python | run python tests with coverage"

.aws-sam/build.toml: ./template.yaml api/package-lock.json api/src/package-lock.json chat/dependencies/requirements.txt chat/src/requirements.txt
sed -Ei.orig 's/"dependencies"/"devDependencies"/' api/src/package.json
cp api/src/package-lock.json api/src/package-lock.json.orig
cd api/src && npm i --package-lock-only && cd -
for d in . api av-download chat docs ; do \
sed -Ei.orig 's/^(\s+)#\*\s/\1/' $$d/template.yaml; \
done

-sam build --cached --parallel

for d in . api av-download chat docs ; do \
mv $$d/template.yaml.orig $$d/template.yaml; \
done
mv api/src/package.json.orig api/src/package.json
mv api/src/package-lock.json.orig api/src/package-lock.json
deps-api:
cd api/src ;\
npm list >/dev/null 2>&1 ;\
src_deps=$$? ;\
cd .. ;\
npm list >/dev/null 2>&1 ;\
dev_deps=$$? ;\
test $$src_deps -eq 0 -a $$dev_deps -eq 0 || npm ci

cd lambdas ;\
deps-av-download:
cd av-download/lambdas ;\
npm list >/dev/null 2>&1 || npm ci
deps-node: deps-api deps-av-download
cover-node: deps-node
cd node && npm run test:coverage
cd api && npm run test:coverage
style-node: deps-node
cd node && npm run prettier
cd api && npm run prettier
test-node: deps-node
cd node && npm run test
cd api && npm run test
deps-python:
cd chat/src && pip install -r requirements.txt && pip install -r requirements-dev.txt
cover-python: deps-python
cd chat && export SKIP_LLM_REQUEST=True && coverage run --source=src -m unittest -v && coverage report --skip-empty
cd chat && coverage run --source=src -m pytest -v && coverage report --skip-empty
cover-html-python: deps-python
cd chat && export SKIP_LLM_REQUEST=True && coverage run --source=src -m unittest -v && coverage html --skip-empty
cd chat && coverage run --source=src -m pytest -v && coverage html --skip-empty
style-python: deps-python
cd chat && ruff check .
style-python-fix: deps-python
cd chat && ruff check --fix .
test-python: deps-python
cd chat && __SKIP_SECRETS__=true SKIP_LLM_REQUEST=True PYTHONPATH=src:test python -m unittest discover -v
cd chat && pytest
python-version:
cd chat && python --version
build: .aws-sam/build.toml
serve-http: deps-node
build:
bash -c "trap 'trap - SIGINT SIGTERM ERR; $(MAKE) reset; exit 1' SIGINT SIGTERM ERR; $(MAKE) .aws-sam/build.toml reset"
validate:
cfn-lint template.yaml **/template.yaml --ignore-checks E3510 W1028 W8001
serve-http: deps-node env.json
@printf '\033[0;31mWARNING: Serving only the local HTTP API. The chat websocket API is not available in local mode.\033[0m\n'
rm -rf .aws-sam
sam local start-api --host 0.0.0.0 --log-file dc-api.log ${SERVE_PARAMS}
sam local start-api -t api/template.yaml --env-vars $$PWD/env.json --host 0.0.0.0 --log-file dc-api.log ${SERVE_PARAMS}
serve-https: SERVE_PARAMS = --port 3002 --ssl-cert-file $$HOME/.dev_cert/dev.rdc.cert.pem --ssl-key-file $$HOME/.dev_cert/dev.rdc.key.pem
serve-https: serve-http
serve: serve-https
start-with-step: deps-node
sam local start-lambda --host 0.0.0.0 --port 3005 --env-vars env.json --log-file lambda.log & \
start-with-step: deps-node env.json
export AWS_DEFAULT_REGION=us-east-1 ;\
sam local start-lambda --warm-containers=LAZY -t av-download/template.yaml --host 0.0.0.0 --port 3005 --env-vars $$PWD/env.json --log-file lambda.log & \
echo $$! > .sam-pids ;\
sam local start-api --host 0.0.0.0 --port 3002 --log-file dc-api.log \
sg open all 3005 ;\
sam local start-api --warm-containers=LAZY -t api/template.yaml --env-vars $$PWD/env.json --host 0.0.0.0 --port 3002 --log-file dc-api.log \
--ssl-cert-file $$HOME/.dev_cert/dev.rdc.cert.pem --ssl-key-file $$HOME/.dev_cert/dev.rdc.key.pem & \
echo $$! >> .sam-pids ;\
docker run --rm -p 8083:8083 -e LAMBDA_ENDPOINT=http://172.17.0.1:3005/ amazon/aws-stepfunctions-local ;\
echo -n "Shutting down..." ;\
sg close all 3005 ;\
kill $$(cat .sam-pids) ;\
rm -f .sam-pids
rm -f .sam-pids ;\
echo ""
state-machine:
export TEMPLATE_DIR=$$(mktemp -d); \
yq -o=json '.Resources.avDownloadStateMachine.Properties.Definition' av-download/template.yaml > $$TEMPLATE_DIR/av_download.json; \
aws stepfunctions create-state-machine --endpoint http://localhost:8083 --definition file://$$TEMPLATE_DIR/av_download.json --name "hlsStitcherStepFunction" --role-arn arn:aws:iam::012345678901:role/DummyRole --no-cli-pager
deps: deps-node deps-python
style: style-node style-python
test: test-node test-python
cover: cover-node cover-python
env:
ln -fs ./env.${ENV}.json ./env.json
env.json:
./bin/make_env.sh
samconfig.%.yaml:
DEV_PREFIX=$* ./bin/make_deploy_config.sh
deploy: build samconfig.$(DEV_PREFIX).yaml
if ! aws sts get-caller-identity --query 'Arn' --output text | grep AWSReservedSSO_AWSAdministratorAccess > /dev/null; then \
echo "You must be logged in as an admin to deploy"; \
exit 1; \
fi
sam deploy --config-file samconfig.$(DEV_PREFIX).yaml --stack-name dc-api-$(DEV_PREFIX)
sync: samconfig.$(DEV_PREFIX).yaml
if ! aws sts get-caller-identity --query 'Arn' --output text | grep AWSReservedSSO_AWSAdministratorAccess > /dev/null; then \
echo "You must be logged in as an admin to sync"; \
exit 1; \
fi
sam sync --config-file samconfig.$(DEV_PREFIX).yaml --stack-name dc-api-$(DEV_PREFIX) --watch $(ARGS)
sync-code: ARGS=--code
sync-code: sync
secrets:
ln -s ../tfvars/dc-api/* .
ln -s ../tfvars/dc-api/*.yaml .
clean:
rm -rf .aws-sam node/node_modules node/src/node_modules python/**/__pycache__ python/.coverage python/.ruff_cache
rm -rf .aws-sam api/.aws-sam chat/.aws-sam av-download/.aws-sam api/node_modules api/src/node_modules chat/**/__pycache__ chat/.coverage chat/.ruff_cache
reset:
for f in $$(find . -maxdepth 2 -name '*.orig'); do mv $$f $${f%%.orig}; done
Loading
Loading