Skip to content

Commit

Permalink
Merge pull request #13 from hwchase17/harrison/add_docs
Browse files Browse the repository at this point in the history
Harrison/add docs
  • Loading branch information
hwchase17 committed Oct 22, 2022
2 parents b4aef9c + 01ebdc3 commit 042e9db
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ self_ask_with_search.run("What is the hometown of the reigning men's U.S. Open c
```

**[LLM Math](https://twitter.com/amasad/status/1568824744367259648?s=20&t=-7wxpXBJinPgDuyHLouP1w)**

To recreate this example, use the following code snippet or check out the [example notebook](examples/llm_math.ipynb).

```
Expand Down
21 changes: 21 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SPHINXAUTOBUILD ?= sphinx-autobuild
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
65 changes: 65 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""Configuration file for the Sphinx documentation builder."""
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import langchain

# -- Project information -----------------------------------------------------

project = "LangChain"
copyright = "2022, Harrison Chase"
author = "Harrison Chase"

version = langchain.__version__
release = langchain.__version__


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autodoc.typehints",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
]

# autodoc_typehints = "signature"
autodoc_typehints = "description"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# html_theme = "sphinx_typlog_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
10 changes: 10 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Welcome to LangChain
==========================

.. toctree::
:maxdepth: 2
:caption: User API

modules/prompt
modules/llms
modules/chains
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
7 changes: 7 additions & 0 deletions docs/modules/chains.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:mod:`langchain.chains`
=======================

.. automodule:: langchain.chains
:members:
:undoc-members:

6 changes: 6 additions & 0 deletions docs/modules/llms.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:mod:`langchain.llms`
=======================

.. automodule:: langchain.llms
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/modules/prompt.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:mod:`langchain.prompt`
=======================

.. automodule:: langchain.prompt
:members:
:undoc-members:
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sphinx==4.5.0
sphinx-autobuild==2021.3.14
sphinx_rtd_theme==1.0.0
sphinx-typlog-theme==0.8.0
1 change: 1 addition & 0 deletions langchain/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
6 changes: 6 additions & 0 deletions langchain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
"""Main entrypoint into package."""

from pathlib import Path

with open(Path(__file__).absolute().parents[0] / "VERSION") as _f:
__version__ = _f.read().strip()

from langchain.chains import (
LLMChain,
LLMMathChain,
Expand Down
10 changes: 10 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
sphinx:
configuration: docs/conf.py
formats: all
python:
version: 3.6
install:
- requirements: docs/requirements.txt
- method: pip
path: .
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
"""Set up the package."""
from pathlib import Path

from setuptools import find_packages, setup

with open(Path(__file__).absolute().parents[0] / "langchain" / "VERSION") as _f:
__version__ = _f.read().strip()

with open("README.md", "r") as f:
long_description = f.read()

setup(
name="langchain",
version_format="0.0.0",
version=__version__,
packages=find_packages(),
description="Building applications with LLMs through composability",
install_requires=["pydantic"],
Expand Down

0 comments on commit 042e9db

Please sign in to comment.