Skip to content

Commit 58def7a

Browse files
committed
First commit
0 parents  commit 58def7a

Some content is hidden

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

47 files changed

+19506
-0
lines changed

.codespellignore

Whitespace-only changes.

.env.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SUPABASE_URL=https://abcd123456789.supabase.co
2+
SUPABASE_SERVICE_KEY=
3+
SUPABASE_JWT_SECRET=
4+
5+
6+
# To separate your traces from other application
7+
LANGSMITH_PROJECT=new-agent
8+
9+
# The following depend on your selected configuration
10+
11+
## LLM choice:
12+
ANTHROPIC_API_KEY=....
13+
FIREWORKS_API_KEY=...
14+
OPENAI_API_KEY=...
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow will run integration tests for the current project once per day
2+
3+
name: Integration Tests
4+
5+
on:
6+
schedule:
7+
- cron: "37 14 * * *" # Run at 7:37 AM Pacific Time (14:37 UTC) every day
8+
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI
9+
10+
# If another scheduled run starts while this workflow is still running,
11+
# cancel the earlier run in favor of the next run.
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
integration-tests:
18+
name: Integration Tests
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest]
22+
python-version: ["3.11", "3.12"]
23+
runs-on: ${{ matrix.os }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install dependencies
31+
run: |
32+
curl -LsSf https://astral.sh/uv/install.sh | sh
33+
uv venv
34+
uv pip install -r pyproject.toml
35+
uv pip install -U pytest-asyncio
36+
- name: Run integration tests
37+
env:
38+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
39+
LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }}
40+
LANGSMITH_TRACING: true
41+
run: |
42+
uv run pytest tests/integration_tests

.github/workflows/unit-tests.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This workflow will run unit tests for the current project
2+
3+
name: CI
4+
5+
on:
6+
push:
7+
branches: ["main"]
8+
pull_request:
9+
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI
10+
11+
# If another push to the same PR or branch happens while this workflow is still running,
12+
# cancel the earlier run in favor of the next run.
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
unit-tests:
19+
name: Unit Tests
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest]
23+
python-version: ["3.11", "3.12"]
24+
runs-on: ${{ matrix.os }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install dependencies
32+
run: |
33+
curl -LsSf https://astral.sh/uv/install.sh | sh
34+
uv venv
35+
uv pip install -r pyproject.toml
36+
- name: Lint with ruff
37+
run: |
38+
uv pip install ruff
39+
uv run ruff check .
40+
- name: Lint with mypy
41+
run: |
42+
uv pip install mypy
43+
uv run mypy --strict src/
44+
- name: Check README spelling
45+
uses: codespell-project/actions-codespell@v2
46+
with:
47+
ignore_words_file: .codespellignore
48+
path: README.md
49+
- name: Check code spelling
50+
uses: codespell-project/actions-codespell@v2
51+
with:
52+
ignore_words_file: .codespellignore
53+
path: src/
54+
- name: Run tests with pytest
55+
run: |
56+
uv pip install pytest
57+
uv run pytest tests/unit_tests

.gitignore

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
.langgraph_api
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
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+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# poetry
99+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100+
# This is especially recommended for binary packages to ensure reproducibility, and is more
101+
# commonly ignored for libraries.
102+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103+
#poetry.lock
104+
105+
# pdm
106+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107+
#pdm.lock
108+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109+
# in version control.
110+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
111+
.pdm.toml
112+
.pdm-python
113+
.pdm-build/
114+
115+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116+
__pypackages__/
117+
118+
# Celery stuff
119+
celerybeat-schedule
120+
celerybeat.pid
121+
122+
# SageMath parsed files
123+
*.sage.py
124+
125+
# Environments
126+
.env
127+
.venv
128+
env/
129+
venv/
130+
ENV/
131+
env.bak/
132+
venv.bak/
133+
134+
# Spyder project settings
135+
.spyderproject
136+
.spyproject
137+
138+
# Rope project settings
139+
.ropeproject
140+
141+
# mkdocs documentation
142+
/site
143+
144+
# mypy
145+
.mypy_cache/
146+
.dmypy.json
147+
dmypy.json
148+
149+
# Pyre type checker
150+
.pyre/
151+
152+
# pytype static type analyzer
153+
.pytype/
154+
155+
# Cython debug symbols
156+
cython_debug/
157+
158+
# PyCharm
159+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
160+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
161+
# and can be added to the global gitignore or merged into this file. For a more nuclear
162+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
163+
#.idea/
164+
uv.lock

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 LangChain
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.PHONY: all format lint test tests test_watch integration_tests docker_tests help extended_tests
2+
3+
# Default target executed when no arguments are given to make.
4+
all: help
5+
6+
# Define a variable for the test file path.
7+
TEST_FILE ?= tests/unit_tests/
8+
9+
test:
10+
python -m pytest $(TEST_FILE)
11+
12+
integration_tests:
13+
python -m pytest tests/integration_tests
14+
15+
test_watch:
16+
python -m ptw --snapshot-update --now . -- -vv tests/unit_tests
17+
18+
test_profile:
19+
python -m pytest -vv tests/unit_tests/ --profile-svg
20+
21+
extended_tests:
22+
python -m pytest --only-extended $(TEST_FILE)
23+
24+
25+
######################
26+
# LINTING AND FORMATTING
27+
######################
28+
29+
# Define a variable for Python and notebook files.
30+
PYTHON_FILES=src/
31+
MYPY_CACHE=.mypy_cache
32+
lint format: PYTHON_FILES=.
33+
lint_diff format_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$|\.ipynb$$')
34+
lint_package: PYTHON_FILES=src
35+
lint_tests: PYTHON_FILES=tests
36+
lint_tests: MYPY_CACHE=.mypy_cache_test
37+
38+
lint lint_diff lint_package lint_tests:
39+
python -m ruff check .
40+
[ "$(PYTHON_FILES)" = "" ] || python -m ruff format $(PYTHON_FILES) --diff
41+
[ "$(PYTHON_FILES)" = "" ] || python -m ruff check --select I $(PYTHON_FILES)
42+
[ "$(PYTHON_FILES)" = "" ] || python -m mypy --strict $(PYTHON_FILES)
43+
[ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) && python -m mypy --strict $(PYTHON_FILES) --cache-dir $(MYPY_CACHE)
44+
45+
format format_diff:
46+
ruff format $(PYTHON_FILES)
47+
ruff check --select I --fix $(PYTHON_FILES)
48+
49+
spell_check:
50+
codespell --toml pyproject.toml
51+
52+
spell_fix:
53+
codespell --toml pyproject.toml -w
54+
55+
######################
56+
# HELP
57+
######################
58+
59+
help:
60+
@echo '----'
61+
@echo 'format - run code formatters'
62+
@echo 'lint - run linters'
63+
@echo 'test - run unit tests'
64+
@echo 'tests - run unit tests'
65+
@echo 'test TEST_FILE=<test_file> - run all tests in file'
66+
@echo 'test_watch - run unit tests in watch mode'
67+

0 commit comments

Comments
 (0)