Skip to main content

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:

  1. Create a Docugami workspace (free trials available)
  2. Create an access token via the Developer Playground for your workspace. Detailed instructions.
  3. 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:

  1. OPENAI_API_KEY: from the OpenAI platform.
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_packs_docugami_kg_rag-0.1.1.tar.gz (13.5 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page