This template contains a reference architecture for Retrieval Augmented Generation against a set of documents using Docugami's XML Knowledge Graph (KG-RAG).
Project description
Docugami KG-RAG Pack
This LlamaPack provides an end-to-end Knowledge Graph Retrieval Augmented Generation flow using Docugami.
Process Documents in Docugami (before you use this template)
Before you use this llamapack, you must have some documents already processed in Docugami. Here's what you need to get started:
- Create a Docugami workspace (free trials available)
- Create an access token via the Developer Playground for your workspace. Detailed instructions.
- Add your documents to Docugami for processing. There are two ways to do this:
- Upload via the simple Docugami web experience. Detailed instructions.
- Upload via the Docugami API, specifically the documents endpoint. Code samples are available for python and JavaScript or you can use the docugami python library.
Once your documents are in Docugami, they are processed and organized into sets of similar documents, e.g. NDAs, Lease Agreements, and Service Agreements. Docugami is not limited to any particular types of documents, and the clusters created depend on your particular documents. You can change the docset assignments later if you wish. You can monitor file status in the simple Docugami webapp, or use a webhook to be informed when your documents are done processing.
Environment Variables
You need to set some required environment variables before using your new app based on this template. These are used to index as well as run the application, and exceptions are raised if the following required environment variables are not set:
OPENAI_API_KEY
: from the OpenAI platform.DOCUGAMI_API_KEY
: from the Docugami Developer Playground
export OPENAI_API_KEY=...
export DOCUGAMI_API_KEY=...
Using the llamapack
Once your documents are finished processing, you can build and use the agent by adding the following code
from llama_index.core.llama_pack import download_llama_pack
# download and install dependencies
DocugamiKgRagPack = download_llama_pack(
"DocugamiKgRagPack", "./docugami_kg_rag"
)
docset_id = ...
pack = DocugamiKgRagPack()
pack.build_agent_for_docset(docset_id)
pack.run(...)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file llama_index_packs_docugami_kg_rag-0.3.0.tar.gz
.
File metadata
- Download URL: llama_index_packs_docugami_kg_rag-0.3.0.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12b5b4b2916d49c4ef191713055c69171f04dacf4a0f4d41ecc7f6328f9365bf |
|
MD5 | c0cbf6fb7a75fcc01eb114188725c7cf |
|
BLAKE2b-256 | a0d2c8996557a0a696a6ec6d0e19161e7aebd4c0f4e1829c1dedda783f805133 |
File details
Details for the file llama_index_packs_docugami_kg_rag-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_packs_docugami_kg_rag-0.3.0-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 150523d727fd132dffc986c75c7e2472cff1d0633bab74068d39848d51b93579 |
|
MD5 | f4e67694b7882974657e0df5fcd09455 |
|
BLAKE2b-256 | 27a3204571e17f1afec4f4355c8ca2d39fea1a0d7f01f19e7a9c52ba680622f2 |