Skip to content

Commit

Permalink
Add notebooks to docs (run-llama#1164)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich authored Apr 16, 2023
1 parent 468e844 commit 8d279d4
Show file tree
Hide file tree
Showing 126 changed files with 9,103 additions and 8,630 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dev_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: cpina/github-action-push-to-another-repository@main
- uses: awalsh128/cache-apt-pkgs-action@latest
env:
API_TOKEN_GITHUB: ${{ secrets.PAT}}
with:
packages: pandoc
source-directory: './docs'
destination-github-username: 'avb-is-me'
destination-repository-name: 'gpt_index'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ target/

# Jupyter Notebook
.ipynb_checkpoints
notebooks/

# IPython
profile_default/
Expand Down
29 changes: 18 additions & 11 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
version: 2
sphinx:
configuration: docs/conf.py
build:
image: testing
formats: all
python:
version: 3.9
install:
- requirements: docs/requirements.txt
- method: pip
path: .

formats:
- htmlzip
- epub

search:
ranking:
'*': 1
getting_started/*: 2
guides/*: 2
how_to/*: 2
use_cases/*: 2
gallery/*: 2
reference/*: 1
index.html*: 2

conda:
environment: docs/readthedocs-environment.yml
27 changes: 27 additions & 0 deletions docs/build_notebooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import json
import os

source_dir = "../examples/"
dest_dir = "./guides/notebooks/"
relative_path = "../../../../examples"


for example_dir in os.listdir(source_dir):
example_dir_path = os.path.join(source_dir, example_dir)

for nb_name in os.listdir(example_dir_path):
if not nb_name.endswith(".ipynb"):
continue

# make dest folder in docs
os.makedirs(os.path.join(dest_dir, example_dir), exist_ok=True)

# build link text
relative_nb_path = os.path.join(relative_path, example_dir, nb_name)
nb_link_text = json.dumps({"path": relative_nb_path})

# write nbsphinx-link document
nbsphinx_name = nb_name.replace(".ipynb", ".nblink")
nbsphinx_path = os.path.join(dest_dir, example_dir, nbsphinx_name)
with open(nbsphinx_path, "w") as f:
f.write(nb_link_text)
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"sphinx_rtd_theme",
"sphinx.ext.mathjax",
"myst_parser",
"nbsphinx",
"nbsphinx_link",
]

myst_heading_anchors = 4
Expand All @@ -55,6 +57,8 @@
html_title = "LlamaIndex"
html_static_path = ["_static"]

# nbsphinx options
nbsphinx_execute = "never"
html_css_files = [
"css/custom.css",
]
Expand Down
171 changes: 170 additions & 1 deletion docs/guides/notebooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,173 @@ Notebooks

We offer a wide variety of example notebooks. They are referenced throughout the documentation.

Example notebooks are found `here <https://github.com/jerryjliu/gpt_index/tree/main/examples>`_.
All examples can be accessed using the menu links or can be found `directly in the repository`_.

.. _directly in the repository: https://github.com/jerryjliu/llama_index/tree/main/examples

.. toctree::
:glob:
:maxdepth: 1
:caption: Async

./notebooks/async/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Azure

notebooks/azure_demo/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Chatbot

notebooks/chatbot/*


.. toctree::
:glob:
:maxdepth: 1
:caption: ChatGPT Plugin

notebooks/chatgpt_plugin/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Composable Indices

notebooks/composable_indices/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Cost Analysis

notebooks/cost_analysis/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Data Connectors

notebooks/data_connectors/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Docstore

notebooks/docstore/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Evaluation

notebooks/evaluation/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Gastby

notebooks/gatsby/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Knowledge Graph

notebooks/knowledge_graph/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Langchain Integration

notebooks/langchain_demo/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Multimodal

notebooks/multimodal/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Node Post-Processor

notebooks/node_postprocessor/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Optimizer

notebooks/optimizer/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Paul Graham Essay

notebooks/paul_graham_essay/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Playground

notebooks/playground/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Query Transformations

notebooks/query_transformations/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Structured Indices

notebooks/struct_indices/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Wikipedia

notebooks/test_wiki/*


.. toctree::
:glob:
:maxdepth: 1
:caption: Vector Indices

notebooks/vector_indices/*
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/async/AsyncComposableIndicesSEC.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/async/AsyncGPTTreeIndexDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/async/AsyncGPTTreeIndexDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/async/AsyncLLMPredictorDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/async/AsyncLLMPredictorDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/async/AsyncQueryDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/async/AsyncQueryDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/azure_demo/AzureOpenAI.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/azure_demo/AzureOpenAI.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/chatbot/Chatbot_SEC.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/chatbot/Chatbot_SEC.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/chatgpt_plugin/ChatGPTRetrievalPluginIndexDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/chatgpt_plugin/ChatGPTRetrievalPluginReaderDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/chatgpt_plugin/ChatGPT_Retrieval_Plugin_Upload.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/composable_indices/City_Analysis-Decompose-KeywordTable.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/composable_indices/ComposableIndices-Prior.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/composable_indices/ComposableIndices-Weaviate.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/composable_indices/ComposableIndices.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/composable_indices/QASummaryGraph.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/cost_analysis/TokenPredictor.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/cost_analysis/TokenPredictor.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/ChromaDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/ChromaDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/DatabaseReaderDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/DiscordDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/DiscordDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/FaissDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/FaissDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/GithubRepositoryReaderDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/GoogleDocsDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/MakeDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/MakeDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/MboxReaderDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/MilvusReaderDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/MongoDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/MongoDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/NotionDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/NotionDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/ObsidianReaderDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/PineconeDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/PineconeDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/QdrantDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/QdrantDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/SlackDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/SlackDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/TwitterDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/TwitterDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/WeaviateDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/WeaviateDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/data_connectors/WebPageDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/data_connectors/WebPageDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/docstore/DocstoreDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/docstore/DocstoreDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/evaluation/GuardrailsDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/evaluation/GuardrailsDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/evaluation/LangchainOutputParserDemo.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/evaluation/TestNYC-Evaluation-Query.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/evaluation/TestNYC-Evaluation.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/evaluation/TestNYC-Evaluation.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/gatsby/TestGatsby.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/gatsby/TestGatsby.ipynb"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/knowledge_graph/KnowledgeGraphDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/langchain_demo/LangchainDemo.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/langchain_demo/LangchainDemo.ipynb"}
1 change: 1 addition & 0 deletions docs/guides/notebooks/multimodal/Multimodal.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path": "../../../../examples/multimodal/Multimodal.ipynb"}
Loading

0 comments on commit 8d279d4

Please sign in to comment.