diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 000000000..d4bb2cbb9 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# 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 +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) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..491867b37 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,30 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'Intelligence Layer☯️' +copyright = '2023, Aleph Alpha' +author = 'Aleph Alpha' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.napoleon'] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +import os +import sys +sys.path.insert(0, os.path.abspath('../src')) + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'alabaster' +html_static_path = ['_static'] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..54b487473 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,20 @@ +.. Intelligence Layer☯️ documentation master file, created by + sphinx-quickstart on Fri Oct 27 12:44:30 2023. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Intelligence Layer☯️'s documentation! +================================================ + +.. toctree:: + :maxdepth: 9 + :caption: Contents: + + modules + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/intelligence_layer.connectors.retrievers.rst b/docs/intelligence_layer.connectors.retrievers.rst new file mode 100644 index 000000000..8269b79bb --- /dev/null +++ b/docs/intelligence_layer.connectors.retrievers.rst @@ -0,0 +1,37 @@ +intelligence\_layer.connectors.retrievers package +================================================= + +Submodules +---------- + +intelligence\_layer.connectors.retrievers.base\_retriever module +---------------------------------------------------------------- + +.. automodule:: intelligence_layer.connectors.retrievers.base_retriever + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.connectors.retrievers.document\_index\_retriever module +--------------------------------------------------------------------------- + +.. automodule:: intelligence_layer.connectors.retrievers.document_index_retriever + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.connectors.retrievers.in\_memory\_retriever module +---------------------------------------------------------------------- + +.. automodule:: intelligence_layer.connectors.retrievers.in_memory_retriever + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: intelligence_layer.connectors.retrievers + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/intelligence_layer.connectors.rst b/docs/intelligence_layer.connectors.rst new file mode 100644 index 000000000..02fc15ba3 --- /dev/null +++ b/docs/intelligence_layer.connectors.rst @@ -0,0 +1,29 @@ +intelligence\_layer.connectors package +====================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + intelligence_layer.connectors.retrievers + +Submodules +---------- + +intelligence\_layer.connectors.document\_index module +----------------------------------------------------- + +.. automodule:: intelligence_layer.connectors.document_index + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: intelligence_layer.connectors + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/intelligence_layer.core.rst b/docs/intelligence_layer.core.rst new file mode 100644 index 000000000..ae747d3de --- /dev/null +++ b/docs/intelligence_layer.core.rst @@ -0,0 +1,77 @@ +intelligence\_layer.core package +================================ + +Submodules +---------- + +intelligence\_layer.core.complete module +---------------------------------------- + +.. automodule:: intelligence_layer.core.complete + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.core.echo module +------------------------------------ + +.. automodule:: intelligence_layer.core.echo + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.core.evaluator module +----------------------------------------- + +.. automodule:: intelligence_layer.core.evaluator + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.core.explain module +--------------------------------------- + +.. automodule:: intelligence_layer.core.explain + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.core.logger module +-------------------------------------- + +.. automodule:: intelligence_layer.core.logger + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.core.prompt\_template module +------------------------------------------------ + +.. automodule:: intelligence_layer.core.prompt_template + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.core.task module +------------------------------------ + +.. automodule:: intelligence_layer.core.task + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.core.text\_highlight module +----------------------------------------------- + +.. automodule:: intelligence_layer.core.text_highlight + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: intelligence_layer.core + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/intelligence_layer.rst b/docs/intelligence_layer.rst new file mode 100644 index 000000000..8759a9ee0 --- /dev/null +++ b/docs/intelligence_layer.rst @@ -0,0 +1,7 @@ +My Title +********* + +.. automodule:: intelligence_layer + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/intelligence_layer.use_cases.classify.rst b/docs/intelligence_layer.use_cases.classify.rst new file mode 100644 index 000000000..f60cd53e4 --- /dev/null +++ b/docs/intelligence_layer.use_cases.classify.rst @@ -0,0 +1,21 @@ +intelligence\_layer.use\_cases.classify package +=============================================== + +Submodules +---------- + +intelligence\_layer.use\_cases.classify.single\_label\_classify module +---------------------------------------------------------------------- + +.. automodule:: intelligence_layer.use_cases.classify.single_label_classify + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: intelligence_layer.use_cases.classify + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/intelligence_layer.use_cases.qa.rst b/docs/intelligence_layer.use_cases.qa.rst new file mode 100644 index 000000000..925108328 --- /dev/null +++ b/docs/intelligence_layer.use_cases.qa.rst @@ -0,0 +1,45 @@ +intelligence\_layer.use\_cases.qa package +========================================= + +Submodules +---------- + +intelligence\_layer.use\_cases.qa.long\_context\_qa module +---------------------------------------------------------- + +.. automodule:: intelligence_layer.use_cases.qa.long_context_qa + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.use\_cases.qa.multiple\_chunk\_qa module +------------------------------------------------------------ + +.. automodule:: intelligence_layer.use_cases.qa.multiple_chunk_qa + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.use\_cases.qa.retriever\_based\_qa module +------------------------------------------------------------- + +.. automodule:: intelligence_layer.use_cases.qa.retriever_based_qa + :members: + :undoc-members: + :show-inheritance: + +intelligence\_layer.use\_cases.qa.single\_chunk\_qa module +---------------------------------------------------------- + +.. automodule:: intelligence_layer.use_cases.qa.single_chunk_qa + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: intelligence_layer.use_cases.qa + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/intelligence_layer.use_cases.rst b/docs/intelligence_layer.use_cases.rst new file mode 100644 index 000000000..ada2ac28b --- /dev/null +++ b/docs/intelligence_layer.use_cases.rst @@ -0,0 +1,21 @@ +intelligence\_layer.use\_cases package +====================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + intelligence_layer.use_cases.classify + intelligence_layer.use_cases.qa + intelligence_layer.use_cases.search + intelligence_layer.use_cases.summarize + +Module contents +--------------- + +.. automodule:: intelligence_layer.use_cases + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/intelligence_layer.use_cases.search.rst b/docs/intelligence_layer.use_cases.search.rst new file mode 100644 index 000000000..d20a4ab8e --- /dev/null +++ b/docs/intelligence_layer.use_cases.search.rst @@ -0,0 +1,21 @@ +intelligence\_layer.use\_cases.search package +============================================= + +Submodules +---------- + +intelligence\_layer.use\_cases.search.search module +--------------------------------------------------- + +.. automodule:: intelligence_layer.use_cases.search.search + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: intelligence_layer.use_cases.search + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/intelligence_layer.use_cases.summarize.rst b/docs/intelligence_layer.use_cases.summarize.rst new file mode 100644 index 000000000..88fd534ba --- /dev/null +++ b/docs/intelligence_layer.use_cases.summarize.rst @@ -0,0 +1,21 @@ +intelligence\_layer.use\_cases.summarize package +================================================ + +Submodules +---------- + +intelligence\_layer.use\_cases.summarize.summarize module +--------------------------------------------------------- + +.. automodule:: intelligence_layer.use_cases.summarize.summarize + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: intelligence_layer.use_cases.summarize + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 000000000..32bb24529 --- /dev/null +++ b/docs/make.bat @@ -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 + +%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.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/modules.rst b/docs/modules.rst new file mode 100644 index 000000000..b327c2bba --- /dev/null +++ b/docs/modules.rst @@ -0,0 +1,4 @@ +.. toctree:: + :maxdepth: 4 + + intelligence_layer \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 5de87fb64..99deba186 100644 --- a/poetry.lock +++ b/poetry.lock @@ -150,6 +150,17 @@ files = [ [package.dependencies] frozenlist = ">=1.1.0" +[[package]] +name = "alabaster" +version = "0.7.13" +description = "A configurable sidebar-enabled Sphinx theme" +optional = false +python-versions = ">=3.6" +files = [ + {file = "alabaster-0.7.13-py3-none-any.whl", hash = "sha256:1ee19aca801bbabb5ba3f5f258e4422dfa86f82f3e9cefb0859b283cdd7f62a3"}, + {file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, +] + [[package]] name = "aleph-alpha-client" version = "4.0.0" @@ -809,6 +820,17 @@ files = [ {file = "distlib-0.3.7.tar.gz", hash = "sha256:9dafe54b34a028eafd95039d5e5d4851a13734540f1331060d31c9916e7147a8"}, ] +[[package]] +name = "docutils" +version = "0.20.1" +description = "Docutils -- Python Documentation Utilities" +optional = false +python-versions = ">=3.7" +files = [ + {file = "docutils-0.20.1-py3-none-any.whl", hash = "sha256:96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6"}, + {file = "docutils-0.20.1.tar.gz", hash = "sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b"}, +] + [[package]] name = "exceptiongroup" version = "1.1.3" @@ -1305,6 +1327,17 @@ files = [ {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, ] +[[package]] +name = "imagesize" +version = "1.4.1" +description = "Getting image size from png/jpeg/jpeg2000/gif file" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "imagesize-1.4.1-py2.py3-none-any.whl", hash = "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b"}, + {file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"}, +] + [[package]] name = "iniconfig" version = "2.0.0" @@ -3583,6 +3616,17 @@ files = [ {file = "sniffio-1.3.0.tar.gz", hash = "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101"}, ] +[[package]] +name = "snowballstemmer" +version = "2.2.0" +description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." +optional = false +python-versions = "*" +files = [ + {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"}, + {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, +] + [[package]] name = "soupsieve" version = "2.5" @@ -3594,6 +3638,144 @@ files = [ {file = "soupsieve-2.5.tar.gz", hash = "sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690"}, ] +[[package]] +name = "sphinx" +version = "7.2.6" +description = "Python documentation generator" +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinx-7.2.6-py3-none-any.whl", hash = "sha256:1e09160a40b956dc623c910118fa636da93bd3ca0b9876a7b3df90f07d691560"}, + {file = "sphinx-7.2.6.tar.gz", hash = "sha256:9a5160e1ea90688d5963ba09a2dcd8bdd526620edbb65c328728f1b2228d5ab5"}, +] + +[package.dependencies] +alabaster = ">=0.7,<0.8" +babel = ">=2.9" +colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} +docutils = ">=0.18.1,<0.21" +imagesize = ">=1.3" +Jinja2 = ">=3.0" +packaging = ">=21.0" +Pygments = ">=2.14" +requests = ">=2.25.0" +snowballstemmer = ">=2.0" +sphinxcontrib-applehelp = "*" +sphinxcontrib-devhelp = "*" +sphinxcontrib-htmlhelp = ">=2.0.0" +sphinxcontrib-jsmath = "*" +sphinxcontrib-qthelp = "*" +sphinxcontrib-serializinghtml = ">=1.1.9" + +[package.extras] +docs = ["sphinxcontrib-websupport"] +lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-simplify", "isort", "mypy (>=0.990)", "ruff", "sphinx-lint", "types-requests"] +test = ["cython (>=3.0)", "filelock", "html5lib", "pytest (>=4.6)", "setuptools (>=67.0)"] + +[[package]] +name = "sphinxcontrib-applehelp" +version = "1.0.7" +description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books" +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinxcontrib_applehelp-1.0.7-py3-none-any.whl", hash = "sha256:094c4d56209d1734e7d252f6e0b3ccc090bd52ee56807a5d9315b19c122ab15d"}, + {file = "sphinxcontrib_applehelp-1.0.7.tar.gz", hash = "sha256:39fdc8d762d33b01a7d8f026a3b7d71563ea3b72787d5f00ad8465bd9d6dfbfa"}, +] + +[package.dependencies] +Sphinx = ">=5" + +[package.extras] +lint = ["docutils-stubs", "flake8", "mypy"] +test = ["pytest"] + +[[package]] +name = "sphinxcontrib-devhelp" +version = "1.0.5" +description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp documents" +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinxcontrib_devhelp-1.0.5-py3-none-any.whl", hash = "sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f"}, + {file = "sphinxcontrib_devhelp-1.0.5.tar.gz", hash = "sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212"}, +] + +[package.dependencies] +Sphinx = ">=5" + +[package.extras] +lint = ["docutils-stubs", "flake8", "mypy"] +test = ["pytest"] + +[[package]] +name = "sphinxcontrib-htmlhelp" +version = "2.0.4" +description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files" +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinxcontrib_htmlhelp-2.0.4-py3-none-any.whl", hash = "sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9"}, + {file = "sphinxcontrib_htmlhelp-2.0.4.tar.gz", hash = "sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a"}, +] + +[package.dependencies] +Sphinx = ">=5" + +[package.extras] +lint = ["docutils-stubs", "flake8", "mypy"] +test = ["html5lib", "pytest"] + +[[package]] +name = "sphinxcontrib-jsmath" +version = "1.0.1" +description = "A sphinx extension which renders display math in HTML via JavaScript" +optional = false +python-versions = ">=3.5" +files = [ + {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"}, + {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"}, +] + +[package.extras] +test = ["flake8", "mypy", "pytest"] + +[[package]] +name = "sphinxcontrib-qthelp" +version = "1.0.6" +description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp documents" +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinxcontrib_qthelp-1.0.6-py3-none-any.whl", hash = "sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4"}, + {file = "sphinxcontrib_qthelp-1.0.6.tar.gz", hash = "sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d"}, +] + +[package.dependencies] +Sphinx = ">=5" + +[package.extras] +lint = ["docutils-stubs", "flake8", "mypy"] +test = ["pytest"] + +[[package]] +name = "sphinxcontrib-serializinghtml" +version = "1.1.9" +description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)" +optional = false +python-versions = ">=3.9" +files = [ + {file = "sphinxcontrib_serializinghtml-1.1.9-py3-none-any.whl", hash = "sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1"}, + {file = "sphinxcontrib_serializinghtml-1.1.9.tar.gz", hash = "sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54"}, +] + +[package.dependencies] +Sphinx = ">=5" + +[package.extras] +lint = ["docutils-stubs", "flake8", "mypy"] +test = ["pytest"] + [[package]] name = "stack-data" version = "0.6.3" @@ -4317,4 +4499,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "9773eec3c97ac603b47306b3d3e6ea0d6364a71ad0733be2a22f59a8e364b322" +content-hash = "31dc20ac3acf948f58be00b7991fbb878f5814ae29fe9c42d263497c0aac9690" diff --git a/pyproject.toml b/pyproject.toml index 1654525aa..d9089548f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,6 @@ nbconvert = "^7.9.2" datasets = "^2.14.5" jupyter = "^1.0.0" requests = "^2.31.0" -pytest-xdist = "^3.3.1" [tool.poetry.group.dev.dependencies] pytest = "*" @@ -40,6 +39,8 @@ types-setuptools="*" types-decorator = "*" types-requests = "*" types-tqdm = "*" +sphinx = "^7.2.6" +pytest-xdist = "^3.3.1" [tool.mypy] files = "src,tests"