Skip to content

Commit 97be64f

Browse files
authored
Merge pull request #1 from hwchase17/master
merge
2 parents 3989c79 + d6d6f32 commit 97be64f

File tree

741 files changed

+55025
-10334
lines changed

Some content is hidden

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

741 files changed

+55025
-10334
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.venv
2+
.github
3+
.git
4+
.mypy_cache
5+
.pytest_cache
6+
Dockerfile

CONTRIBUTING.md renamed to .github/CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ good code into the codebase.
4646

4747
### 🏭Release process
4848

49-
As of now, LangChain has an ad hoc release process: releases are cut with high frequency via by
49+
As of now, LangChain has an ad hoc release process: releases are cut with high frequency by
5050
a developer and published to [PyPI](https://pypi.org/project/langchain/).
5151

5252
LangChain follows the [semver](https://semver.org/) versioning standard. However, as pre-1.0 software,
@@ -73,6 +73,8 @@ poetry install -E all
7373

7474
This will install all requirements for running the package, examples, linting, formatting, tests, and coverage. Note the `-E all` flag will install all optional dependencies necessary for integration testing.
7575

76+
❗Note: If you're running Poetry 1.4.1 and receive a `WheelFileValidationError` for `debugpy` during installation, you can try either downgrading to Poetry 1.4.0 or disabling "modern installation" (`poetry config installer.modern-installation false`) and re-install requirements. See [this `debugpy` issue](https://github.com/microsoft/debugpy/issues/1246) for more details.
77+
7678
Now, you should be able to run the common tasks in the following section.
7779

7880
## ✅Common Tasks
@@ -121,6 +123,12 @@ To run unit tests:
121123
make test
122124
```
123125

126+
To run unit tests in Docker:
127+
128+
```bash
129+
make docker_tests
130+
```
131+
124132
If you add new logic, please add a unit test.
125133

126134
Integration tests cover logic that requires making calls to outside APIs (often integration with other services).

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ celerybeat.pid
106106

107107
# Environments
108108
.env
109+
.envrc
109110
.venv
110111
.venvs
111112
env/
@@ -134,3 +135,9 @@ dmypy.json
134135

135136
# macOS display setting files
136137
.DS_Store
138+
139+
# Wandb directory
140+
wandb/
141+
142+
# asdf tool versions
143+
.tool-versions

Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This is a Dockerfile for running unit tests
2+
3+
# Use the Python base image
4+
FROM python:3.11.2-bullseye AS builder
5+
6+
# Define the version of Poetry to install (default is 1.4.2)
7+
ARG POETRY_VERSION=1.4.2
8+
9+
# Define the directory to install Poetry to (default is /opt/poetry)
10+
ARG POETRY_HOME=/opt/poetry
11+
12+
# Create a Python virtual environment for Poetry and install it
13+
RUN python3 -m venv ${POETRY_HOME} && \
14+
$POETRY_HOME/bin/pip install --upgrade pip && \
15+
$POETRY_HOME/bin/pip install poetry==${POETRY_VERSION}
16+
17+
# Test if Poetry is installed in the expected path
18+
RUN echo "Poetry version:" && $POETRY_HOME/bin/poetry --version
19+
20+
# Set the working directory for the app
21+
WORKDIR /app
22+
23+
# Use a multi-stage build to install dependencies
24+
FROM builder AS dependencies
25+
26+
# Copy only the dependency files for installation
27+
COPY pyproject.toml poetry.lock poetry.toml ./
28+
29+
# Install the Poetry dependencies (this layer will be cached as long as the dependencies don't change)
30+
RUN $POETRY_HOME/bin/poetry install --no-interaction --no-ansi
31+
32+
# Use a multi-stage build to run tests
33+
FROM dependencies AS tests
34+
35+
# Copy the rest of the app source code (this layer will be invalidated and rebuilt whenever the source code changes)
36+
COPY . .
37+
38+
RUN /opt/poetry/bin/poetry install --no-interaction --no-ansi
39+
40+
# Set the entrypoint to run tests using Poetry
41+
ENTRYPOINT ["/opt/poetry/bin/poetry", "run", "pytest"]
42+
43+
# Set the default command to run all unit tests
44+
CMD ["tests/unit_tests"]

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.PHONY: all clean format lint test tests test_watch integration_tests help
1+
.PHONY: all clean format lint test tests test_watch integration_tests docker_tests help
22

33
all: help
4-
4+
55
coverage:
66
poetry run pytest --cov \
77
--cov-config=.coveragerc \
@@ -40,6 +40,10 @@ test_watch:
4040
integration_tests:
4141
poetry run pytest tests/integration_tests
4242

43+
docker_tests:
44+
docker build -t my-langchain-image:test .
45+
docker run --rm my-langchain-image:test
46+
4347
help:
4448
@echo '----'
4549
@echo 'coverage - run unit tests and generate coverage report'
@@ -51,3 +55,4 @@ help:
5155
@echo 'test - run unit tests'
5256
@echo 'test_watch - run unit tests in watch mode'
5357
@echo 'integration_tests - run integration tests'
58+
@echo 'docker_tests - run unit tests in docker'

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This library is aimed at assisting in the development of those types of applicat
3232

3333
**🤖 Agents**
3434

35-
- [Documentation](https://langchain.readthedocs.io/en/latest/use_cases/agents.html)
35+
- [Documentation](https://langchain.readthedocs.io/en/latest/modules/agents.html)
3636
- End-to-end Example: [GPT+WolframAlpha](https://huggingface.co/spaces/JavaFXpert/Chat-GPT-LangChain)
3737

3838
## 📖 Documentation
@@ -42,7 +42,7 @@ Please see [here](https://langchain.readthedocs.io/en/latest/?) for full documen
4242
- Getting started (installation, setting up the environment, simple examples)
4343
- How-To examples (demos, integrations, helper functions)
4444
- Reference (full API docs)
45-
Resources (high-level explanation of core concepts)
45+
- Resources (high-level explanation of core concepts)
4646

4747
## 🚀 What can this help with?
4848

@@ -79,4 +79,4 @@ For more information on these concepts, please see our [full documentation](http
7979

8080
As an open source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infra, or better documentation.
8181

82-
For detailed information on how to contribute, see [here](CONTRIBUTING.md).
82+
For detailed information on how to contribute, see [here](.github/CONTRIBUTING.md).

docs/_static/ApifyActors.png

559 KB
Loading

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
# -- Project information -----------------------------------------------------
2424

2525
project = "🦜🔗 LangChain"
26-
copyright = "2022, Harrison Chase"
26+
copyright = "2023, Harrison Chase"
2727
author = "Harrison Chase"
2828

2929
version = data["tool"]["poetry"]["version"]
3030
release = version
3131

3232
html_title = project + " " + version
33+
html_last_updated_fmt = "%b %d, %Y"
3334

3435

3536
# -- General configuration ---------------------------------------------------
@@ -45,6 +46,7 @@
4546
"sphinx.ext.viewcode",
4647
"sphinxcontrib.autodoc_pydantic",
4748
"myst_nb",
49+
"sphinx_copybutton",
4850
"sphinx_panels",
4951
"IPython.sphinxext.ipython_console_highlighting",
5052
]

docs/deployments.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ A minimal example on how to run LangChain on Vercel using Flask.
3737
## [SteamShip](https://github.com/steamship-core/steamship-langchain/)
3838
This repository contains LangChain adapters for Steamship, enabling LangChain developers to rapidly deploy their apps on Steamship.
3939
This includes: production ready endpoints, horizontal scaling across dependencies, persistant storage of app state, multi-tenancy support, etc.
40+
41+
## [Langchain-serve](https://github.com/jina-ai/langchain-serve)
42+
This repository allows users to serve local chains and agents as RESTful, gRPC, or Websocket APIs thanks to [Jina](https://docs.jina.ai/). Deploy your chains & agents with ease and enjoy independent scaling, serverless and autoscaling APIs, as well as a Streamlit playground on Jina AI Cloud.

0 commit comments

Comments
 (0)