Skip to content

Commit

Permalink
Merge pull request #1 from hwchase17/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
davidbuniat authored Apr 5, 2023
2 parents 3989c79 + d6d6f32 commit 97be64f
Show file tree
Hide file tree
Showing 741 changed files with 55,025 additions and 10,334 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.venv
.github
.git
.mypy_cache
.pytest_cache
Dockerfile
10 changes: 9 additions & 1 deletion CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ good code into the codebase.

### 🏭Release process

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

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

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.

❗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.

Now, you should be able to run the common tasks in the following section.

## ✅Common Tasks
Expand Down Expand Up @@ -121,6 +123,12 @@ To run unit tests:
make test
```

To run unit tests in Docker:

```bash
make docker_tests
```

If you add new logic, please add a unit test.

Integration tests cover logic that requires making calls to outside APIs (often integration with other services).
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ celerybeat.pid

# Environments
.env
.envrc
.venv
.venvs
env/
Expand Down Expand Up @@ -134,3 +135,9 @@ dmypy.json

# macOS display setting files
.DS_Store

# Wandb directory
wandb/

# asdf tool versions
.tool-versions
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This is a Dockerfile for running unit tests

# Use the Python base image
FROM python:3.11.2-bullseye AS builder

# Define the version of Poetry to install (default is 1.4.2)
ARG POETRY_VERSION=1.4.2

# Define the directory to install Poetry to (default is /opt/poetry)
ARG POETRY_HOME=/opt/poetry

# Create a Python virtual environment for Poetry and install it
RUN python3 -m venv ${POETRY_HOME} && \
$POETRY_HOME/bin/pip install --upgrade pip && \
$POETRY_HOME/bin/pip install poetry==${POETRY_VERSION}

# Test if Poetry is installed in the expected path
RUN echo "Poetry version:" && $POETRY_HOME/bin/poetry --version

# Set the working directory for the app
WORKDIR /app

# Use a multi-stage build to install dependencies
FROM builder AS dependencies

# Copy only the dependency files for installation
COPY pyproject.toml poetry.lock poetry.toml ./

# Install the Poetry dependencies (this layer will be cached as long as the dependencies don't change)
RUN $POETRY_HOME/bin/poetry install --no-interaction --no-ansi

# Use a multi-stage build to run tests
FROM dependencies AS tests

# Copy the rest of the app source code (this layer will be invalidated and rebuilt whenever the source code changes)
COPY . .

RUN /opt/poetry/bin/poetry install --no-interaction --no-ansi

# Set the entrypoint to run tests using Poetry
ENTRYPOINT ["/opt/poetry/bin/poetry", "run", "pytest"]

# Set the default command to run all unit tests
CMD ["tests/unit_tests"]
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: all clean format lint test tests test_watch integration_tests help
.PHONY: all clean format lint test tests test_watch integration_tests docker_tests help

all: help

coverage:
poetry run pytest --cov \
--cov-config=.coveragerc \
Expand Down Expand Up @@ -40,6 +40,10 @@ test_watch:
integration_tests:
poetry run pytest tests/integration_tests

docker_tests:
docker build -t my-langchain-image:test .
docker run --rm my-langchain-image:test

help:
@echo '----'
@echo 'coverage - run unit tests and generate coverage report'
Expand All @@ -51,3 +55,4 @@ help:
@echo 'test - run unit tests'
@echo 'test_watch - run unit tests in watch mode'
@echo 'integration_tests - run integration tests'
@echo 'docker_tests - run unit tests in docker'
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This library is aimed at assisting in the development of those types of applicat

**🤖 Agents**

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

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

## 🚀 What can this help with?

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

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.

For detailed information on how to contribute, see [here](CONTRIBUTING.md).
For detailed information on how to contribute, see [here](.github/CONTRIBUTING.md).
Binary file added docs/_static/ApifyActors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
# -- Project information -----------------------------------------------------

project = "🦜🔗 LangChain"
copyright = "2022, Harrison Chase"
copyright = "2023, Harrison Chase"
author = "Harrison Chase"

version = data["tool"]["poetry"]["version"]
release = version

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


# -- General configuration ---------------------------------------------------
Expand All @@ -45,6 +46,7 @@
"sphinx.ext.viewcode",
"sphinxcontrib.autodoc_pydantic",
"myst_nb",
"sphinx_copybutton",
"sphinx_panels",
"IPython.sphinxext.ipython_console_highlighting",
]
Expand Down
3 changes: 3 additions & 0 deletions docs/deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ A minimal example on how to run LangChain on Vercel using Flask.
## [SteamShip](https://github.com/steamship-core/steamship-langchain/)
This repository contains LangChain adapters for Steamship, enabling LangChain developers to rapidly deploy their apps on Steamship.
This includes: production ready endpoints, horizontal scaling across dependencies, persistant storage of app state, multi-tenancy support, etc.

## [Langchain-serve](https://github.com/jina-ai/langchain-serve)
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.
Loading

0 comments on commit 97be64f

Please sign in to comment.