Skip to content

Commit

Permalink
Sphinx update
Browse files Browse the repository at this point in the history
  • Loading branch information
arjbingly committed Apr 17, 2024
1 parent 39a8c0e commit d6e354b
Show file tree
Hide file tree
Showing 47 changed files with 133 additions and 122 deletions.
Binary file not shown.
Binary file modified src/docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified src/docs/_build/doctrees/get_started.introduction.doctree
Binary file not shown.
Binary file modified src/docs/_build/doctrees/get_started.llms.doctree
Binary file not shown.
Binary file modified src/docs/_build/doctrees/grag.components.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion src/docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 58797109ea50b041e451aad9460566a5
config: 4e9c7fafa68d58ea0265316a26496cf3
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"outputs": [],
"source": [
"from grag.components.multivec_retriever import Retriever\nfrom grag.components.vectordb.deeplake_client import DeepLakeClient\n\nclient = DeepLakeClient(collection_name=\"your_collection_name\")\n\n## Alternatively to use Chroma\n# from grag.components.vectordb.chroma_client import ChromaClient\n# client = ChromaClient(collection_name=\"ci_test\")\n\nretriever = Retriever(vectordb=client)\n\ndir_path = \"data/pdf\" # path to pdf files\nretriever.ingest(dir_path)"
"import asyncio\nfrom pathlib import Path\n\nfrom grag.components.multivec_retriever import Retriever\nfrom grag.components.vectordb.deeplake_client import DeepLakeClient\n\nclient = DeepLakeClient(collection_name=\"your_collection_name\")\n\n## Alternatively to use Chroma\n# from grag.components.vectordb.chroma_client import ChromaClient\n# client = ChromaClient(collection_name=\"ci_test\")\n\nSYNC = True # Run synchronously (slow)\nASYNC = True # Run asynchronously \n\nclient = DeepLakeClient(collection_name=\"ci_test\")\n# client = ChromaClient(collection_name=\"ci_test\")\nretriever = Retriever(vectordb=client)\n\ndir_path = Path(__file__).parents[2] / \"data/test/pdfs/new_papers\"\n\nif SYNC:\n retriever.ingest(dir_path)\nelif ASYNC:\n asyncio.run(retriever.aingest(dir_path))"
]
}
],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
This cookbook demonstrates how to ingest documents into a vector database.
"""

import asyncio
from pathlib import Path

from grag.components.multivec_retriever import Retriever
from grag.components.vectordb.deeplake_client import DeepLakeClient

Expand All @@ -12,7 +15,16 @@
# from grag.components.vectordb.chroma_client import ChromaClient
# client = ChromaClient(collection_name="ci_test")

SYNC = True # Run synchronously (slow)
ASYNC = True # Run asynchronously

client = DeepLakeClient(collection_name="ci_test")
# client = ChromaClient(collection_name="ci_test")
retriever = Retriever(vectordb=client)

dir_path = "data/pdf" # path to pdf files
retriever.ingest(dir_path)
dir_path = Path(__file__).parents[2] / "data/test/pdfs/new_papers"

if SYNC:
retriever.ingest(dir_path)
elif ASYNC:
asyncio.run(retriever.aingest(dir_path))
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ Document Ingestion
=======================
This cookbook demonstrates how to ingest documents into a vector database.

.. GENERATED FROM PYTHON SOURCE LINES 5-19
.. GENERATED FROM PYTHON SOURCE LINES 5-31
.. code-block:: Python
import asyncio
from pathlib import Path
from grag.components.multivec_retriever import Retriever
from grag.components.vectordb.deeplake_client import DeepLakeClient
Expand All @@ -35,10 +38,19 @@ This cookbook demonstrates how to ingest documents into a vector database.
# from grag.components.vectordb.chroma_client import ChromaClient
# client = ChromaClient(collection_name="ci_test")
SYNC = True # Run synchronously (slow)
ASYNC = True # Run asynchronously
client = DeepLakeClient(collection_name="ci_test")
# client = ChromaClient(collection_name="ci_test")
retriever = Retriever(vectordb=client)
dir_path = "data/pdf" # path to pdf files
retriever.ingest(dir_path)
dir_path = Path(__file__).parents[2] / "data/test/pdfs/new_papers"
if SYNC:
retriever.ingest(dir_path)
elif ASYNC:
asyncio.run(retriever.aingest(dir_path))
.. _sphx_glr_download_auto_examples_Basic-RAG_BasicRAG_ingest.py:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ GRAG Overview
GRAG provides an implementation of Retrieval-Augmented Generation that is completely open-sourced.

Retrieval-Augmented Generation
###################

###############################
32 changes: 16 additions & 16 deletions src/docs/_build/html/_sources/get_started.llms.rst.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
LLMs
=====

GRAG offers two ways to run LLMs locally,
GRAG offers two ways to run LLMs locally:

1. LlamaCPP
2. HuggingFace

To run LLMs using HuggingFace
#############################
This is the easiest way to get started but does not offer as much
This is the easiest way to get started, but does not offer as much
flexibility.
If using a config file (*config.ini*), just change the `model_name` to
to the HuggingFace repo id. *Note that if the models are gated, make sure to
provide an auth token*

To run LLMs using LlamaCPP
#############################
Steps to start with llama.cpp:
LlamaCPP requires models in the form of `.gguf` file. You can either download these model files online,
or

1. Clone the `llama.cpp <https://github.com/ggerganov/llama.cpp>`_ repository.
``git clone https://github.com/ggerganov/llama.cpp.git``
2. Change directory to `llama.cpp` using `cd llama.cpp`
3. To inference using GPU, which is necessary for most models.
* Make sure you have CUDA installed (check using ``nvcc --version``)
* Follow steps from the `llama.cpp documentation <https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#cublas>`_.
How to quantize models.
************************
To quantize the model, run:
``python -m grag.quantize.quantize``

*Note: While inferencing if model is not utilizing GPU check the `BLAS=1` in the outputs and*
*if it is not then try reinstalling using*::
After running the above command, user will be prompted with the following:

CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python --upgrade --force-reinstall --no-cache-dir
1. **Path** where the user wants to clone the `llama.cpp` repo. You can find the repository, `llama.cpp <https://github.com/ggerganov/llama.cpp>`_.

*or follow the solution provided by*
`this Stack Overflow post <https://stackoverflow.com/questions/76963311/llama-cpp-python-not-using-nvidia-gpu-cuda>`_
2. Input the **model path**:

How to quantize models.
************************
* If user wants to download a model from `HuggingFace <https://huggingface.co/models>`_, the user should provide the repository path from HuggingFace.

* If the user has the model downloaded locally, then user will be instructed to copy the model and input the name of the model directory.

3.Finally, the user will be prompted to enter **quantization** settings (recommended Q5_K_M or Q4_K_M, etc.). For more details, check `llama.cpp/examples/quantize/quantize.cpp <https://github.com/ggerganov/llama.cpp/blob/master/examples/quantize/quantize.cpp#L19>`_.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
20 changes: 16 additions & 4 deletions src/docs/_build/html/auto_examples/Basic-RAG/BasicRAG_ingest.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@
<section class="sphx-glr-example-title" id="document-ingestion">
<span id="sphx-glr-auto-examples-basic-rag-basicrag-ingest-py"></span><h1>Document Ingestion<a class="headerlink" href="#document-ingestion" title="Link to this heading"></a></h1>
<p>This cookbook demonstrates how to ingest documents into a vector database.</p>
<div class="highlight-Python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">grag.components.multivec_retriever</span> <span class="kn">import</span> <span class="n">Retriever</span>
<div class="highlight-Python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">asyncio</span>
<span class="kn">from</span> <span class="nn">pathlib</span> <span class="kn">import</span> <span class="n">Path</span>

<span class="kn">from</span> <span class="nn">grag.components.multivec_retriever</span> <span class="kn">import</span> <span class="n">Retriever</span>
<span class="kn">from</span> <span class="nn">grag.components.vectordb.deeplake_client</span> <span class="kn">import</span> <span class="n">DeepLakeClient</span>

<span class="n">client</span> <span class="o">=</span> <span class="n">DeepLakeClient</span><span class="p">(</span><span class="n">collection_name</span><span class="o">=</span><span class="s2">&quot;your_collection_name&quot;</span><span class="p">)</span>
Expand All @@ -109,10 +112,19 @@
<span class="c1"># from grag.components.vectordb.chroma_client import ChromaClient</span>
<span class="c1"># client = ChromaClient(collection_name=&quot;ci_test&quot;)</span>

<span class="n">SYNC</span> <span class="o">=</span> <span class="kc">True</span> <span class="c1"># Run synchronously (slow)</span>
<span class="n">ASYNC</span> <span class="o">=</span> <span class="kc">True</span> <span class="c1"># Run asynchronously</span>

<span class="n">client</span> <span class="o">=</span> <span class="n">DeepLakeClient</span><span class="p">(</span><span class="n">collection_name</span><span class="o">=</span><span class="s2">&quot;ci_test&quot;</span><span class="p">)</span>
<span class="c1"># client = ChromaClient(collection_name=&quot;ci_test&quot;)</span>
<span class="n">retriever</span> <span class="o">=</span> <span class="n">Retriever</span><span class="p">(</span><span class="n">vectordb</span><span class="o">=</span><span class="n">client</span><span class="p">)</span>

<span class="n">dir_path</span> <span class="o">=</span> <span class="s2">&quot;data/pdf&quot;</span> <span class="c1"># path to pdf files</span>
<span class="n">retriever</span><span class="o">.</span><span class="n">ingest</span><span class="p">(</span><span class="n">dir_path</span><span class="p">)</span>
<span class="n">dir_path</span> <span class="o">=</span> <span class="n">Path</span><span class="p">(</span><span class="vm">__file__</span><span class="p">)</span><span class="o">.</span><span class="n">parents</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">/</span> <span class="s2">&quot;data/test/pdfs/new_papers&quot;</span>

<span class="k">if</span> <span class="n">SYNC</span><span class="p">:</span>
<span class="n">retriever</span><span class="o">.</span><span class="n">ingest</span><span class="p">(</span><span class="n">dir_path</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">ASYNC</span><span class="p">:</span>
<span class="n">asyncio</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">retriever</span><span class="o">.</span><span class="n">aingest</span><span class="p">(</span><span class="n">dir_path</span><span class="p">))</span>
</pre></div>
</div>
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-basic-rag-basicrag-ingest-py">
Expand All @@ -137,7 +149,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
2 changes: 1 addition & 1 deletion src/docs/_build/html/auto_examples/Basic-RAG/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
2 changes: 1 addition & 1 deletion src/docs/_build/html/auto_examples/Retriver-GUI/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ <h1>Retriever-GUI Cookbooks<a class="headerlink" href="#retriever-gui-cookbooks"
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
2 changes: 1 addition & 1 deletion src/docs/_build/html/auto_examples_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h1>Cookbooks<a class="headerlink" href="#cookbooks" title="Link to this heading
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
2 changes: 1 addition & 1 deletion src/docs/_build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ <h2 id="V">V</h2>
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
2 changes: 1 addition & 1 deletion src/docs/_build/html/get_started.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h1>Get Started<a class="headerlink" href="#get-started" title="Link to this hea
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
2 changes: 1 addition & 1 deletion src/docs/_build/html/get_started.installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ <h1>Installation<a class="headerlink" href="#installation" title="Link to this h
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
25 changes: 5 additions & 20 deletions src/docs/_build/html/get_started.introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Installation" href="get_started.installation.html" />
<link rel="prev" title="Get Started" href="get_started.html" />
<link rel="search" title="Search" href="search.html" />
</head>

<body class="wy-body-for-nav">
Expand All @@ -49,17 +47,8 @@
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="get_started.html">Get Started</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">GRAG Overview</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#retrieval-augmented-generation">Retrieval-Augmented Generation</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="get_started.installation.html">Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="get_started.llms.html">LLMs</a></li>
<li class="toctree-l2"><a class="reference internal" href="get_started.vectordb.html">Vector Stores</a></li>
</ul>
</li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="get_started.html">Get Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="grag.html">GRAG</a></li>
<li class="toctree-l1"><a class="reference internal" href="auto_examples_index.html">Cookbooks</a></li>
</ul>
Expand All @@ -78,7 +67,6 @@
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="get_started.html">Get Started</a></li>
<li class="breadcrumb-item active">GRAG Overview</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/arjbingly/Capstone_5/blob/main/src/get_started.introduction.rst" class="fa fa-github"> Edit on GitHub</a>
Expand All @@ -100,15 +88,12 @@ <h2>Retrieval-Augmented Generation<a class="headerlink" href="#retrieval-augment

</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="get_started.html" class="btn btn-neutral float-left" title="Get Started" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="get_started.installation.html" class="btn btn-neutral float-right" title="Installation" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<footer>

<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erica Pham, Kunal Inglunkar.</p>
<p>&#169; Copyright 2024, Arjun Bingly, Sanchit Vijay, Erika Pham, Kunal Inglunkar.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
Loading

0 comments on commit d6e354b

Please sign in to comment.