Skip to content

Commit 30698c9

Browse files
authored
Initial commit
0 parents  commit 30698c9

32 files changed

+3181
-0
lines changed

.dockerignore

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
# VSCode configuration
132+
.vscode
133+
134+
# Chat function config
135+
config.json
136+
137+
# README
138+
README.md
139+
140+
# GitHub
141+
.github
142+
143+
# Data folder
144+
data/
145+
146+
# Test reports
147+
reports/
148+
149+
# Synthetic data conversations
150+
src/agents/utils/example_inputs/
151+
src/agents/utils/synthetic_conversations/
152+
src/agents/utils/synthetic_conversation_generation.py
153+
src/agents/utils/testbench_prompts.py
154+
src/agents/utils/langgraph_viz.py
155+
156+
# development agents
157+
src/agents/student_agent/

.env.example

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
OPENAI_API_KEY=test
2+
OPENAI_MODEL=test
3+
4+
# for use of googleai
5+
GOOGLE_AI_API_KEY=test
6+
GOOGLE_AI_MODEL=test
7+
8+
# for use of azureopenai
9+
AZURE_OPENAI_API_KEY=test
10+
AZURE_OPENAI_ENDPOINT=test
11+
AZURE_OPENAI_API_VERSION=test
12+
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=test
13+
AZURE_OPENAI_EMBEDDING_3072_DEPLOYMENT=test
14+
AZURE_OPENAI_EMBEDDING_1536_DEPLOYMENT=test
15+
AZURE_OPENAI_EMBEDDING_3072_MODEL=test
16+
AZURE_OPENAI_EMBEDDING_1536_MODEL=test
17+
18+
# used for langsmith for monitoring the requests sent to Azureopenai cloud service;
19+
LANGCHAIN_TRACING_V2=true
20+
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
21+
LANGCHAIN_API_KEY=""
22+
LANGCHAIN_PROJECT="project"

.github/workflows/dev.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Dev deployment of chatbot lambda function
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
name: Dev deployment of chatbot lambda function
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.13"]
16+
env:
17+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
18+
OPENAI_MODEL: ${{ vars.OPENAI_MODEL }}
19+
GOOGLE_AI_API_KEY: ${{ secrets.GOOGLE_AI_API_KEY }}
20+
GOOGLE_AI_MODEL: ${{ vars.GOOGLE_AI_MODEL }}
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
id: python-setup
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
# - name: Load cached venv
32+
# id: dependencies-cache
33+
# uses: actions/cache@v3
34+
# with:
35+
# path: .venv
36+
# key: venv-${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}
37+
38+
- name: Create Venv if Cache not found
39+
# if: steps.dependencies-cache.outputs.cache-hit != 'true'
40+
run: |
41+
python -m venv .venv
42+
43+
- name: Install dependencies
44+
# if: steps.dependencies-cache.outputs.cache-hit != 'true'
45+
run: |
46+
pip install --upgrade pip
47+
pip install -r requirements.txt
48+
49+
- name: Run tests
50+
if: always()
51+
run: |
52+
source .venv/bin/activate
53+
pytest --junit-xml=./reports/pytest.xml --tb=auto -v
54+
55+
- name: Upload test results
56+
uses: actions/upload-artifact@v4
57+
if: always()
58+
with:
59+
name: test-results
60+
path: ./reports/pytest.xml
61+
if-no-files-found: warn
62+
63+
build:
64+
name: Build Docker Image
65+
uses: lambda-feedback/chat-function-workflows/.github/workflows/gh_build.yml@main
66+
needs: test
67+
permissions:
68+
contents: read
69+
id-token: write
70+
packages: write
71+
72+
deploy:
73+
name: Deploy to Lambda Feedback
74+
uses: lambda-feedback/chat-function-workflows/.github/workflows/dev_deploy.yml@main
75+
needs: test
76+
with:
77+
template-repository-name: "lambda-feedback/chat-function-boilerplate"
78+
# allow for developer to specify the environment variables that are used by the deployed AWS Lambda. Default to mock then admin can update.
79+
deployed-environment-variables: '[\"OPENAI_API_KEY\",\"OPENAI_MODEL\",\"GOOGLE_AI_API_KEY\",\"GOOGLE_AI_MODEL\"]'
80+
permissions:
81+
contents: read
82+
id-token: write
83+
packages: write
84+
secrets:
85+
aws-access-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
86+
aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
87+
function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY }}

.github/workflows/main.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Main deployment of Chatbot lambda function
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
name: Staging deployment tests
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.13"]
16+
env:
17+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
18+
OPENAI_MODEL: ${{ vars.OPENAI_MODEL }}
19+
GOOGLE_AI_API_KEY: ${{ secrets.GOOGLE_AI_API_KEY }}
20+
GOOGLE_AI_MODEL: ${{ vars.GOOGLE_AI_MODEL }}
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
id: python-setup
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
# - name: Load cached venv
32+
# id: dependencies-cache
33+
# uses: actions/cache@v3
34+
# with:
35+
# path: .venv
36+
# key: venv-${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}
37+
38+
- name: Create Venv if Cache not found
39+
# if: steps.dependencies-cache.outputs.cache-hit != 'true'
40+
run: |
41+
python -m venv .venv
42+
43+
- name: Install dependencies
44+
# if: steps.dependencies-cache.outputs.cache-hit != 'true'
45+
run: |
46+
pip install --upgrade pip
47+
pip install -r requirements.txt
48+
49+
- name: Run tests
50+
if: always()
51+
run: |
52+
source .venv/bin/activate
53+
pytest --junit-xml=./reports/pytest.xml --tb=auto -v
54+
55+
- name: Upload test results
56+
uses: actions/upload-artifact@v4
57+
if: always()
58+
with:
59+
name: test-results
60+
path: ./reports/pytest.xml
61+
if-no-files-found: warn
62+
63+
build:
64+
name: Build Docker Image
65+
uses: lambda-feedback/chat-function-workflows/.github/workflows/gh_build.yml@main
66+
needs: test
67+
permissions:
68+
contents: read
69+
id-token: write
70+
packages: write
71+
72+
deploy:
73+
name: Deploy to Lambda Feedback
74+
uses: lambda-feedback/chat-function-workflows/.github/workflows/main_deploy.yml@main
75+
needs: test
76+
with:
77+
template-repository-name: "lambda-feedback/chat-function-boilerplate"
78+
# allow for developer to specify the environment variables that are used by the deployed AWS Lambda. Default to mock then admin can update.
79+
deployed-environment-variables: '[\"OPENAI_API_KEY\",\"OPENAI_MODEL\",\"GOOGLE_AI_API_KEY\",\"GOOGLE_AI_MODEL\"]'
80+
permissions:
81+
contents: read
82+
id-token: write
83+
packages: write
84+
issues: write
85+
secrets:
86+
aws-access-key-id: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_ID }}
87+
aws-secret-key: ${{ secrets.LAMBDA_CONTAINER_PIPELINE_AWS_SECRET}}
88+
function-admin-api-key: ${{ secrets.FUNCTION_ADMIN_API_KEY }}
89+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-report.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test Report
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build, Test and Deploy"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: read
11+
actions: read
12+
checks: write
13+
14+
jobs:
15+
report:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Test Report
19+
uses: dorny/test-reporter@v1
20+
if: always()
21+
with:
22+
name: Pytest Report
23+
artifact: test-results
24+
path: '*.xml'
25+
reporter: java-junit
26+
fail-on-error: false

0 commit comments

Comments
 (0)