Skip to main content

LitRevAI (Literature Review AI) is a Python package designed to automate systematic literature reviews using natural language processing (NLP) techniques.

Project description

LitRevAI

PyPI - Version PyPI - Python Version


Table of Contents

Description

LitRevAI (Literature Review AI) is a Python package designed to automate systematic literature reviews using natural language processing (NLP) techniques. It supports the import of documents from Zotero, including metadata, for streamlined analysis. By integrating Retrieval-Augmented Generation with advanced topic modeling via BERTopic, LitRevAI offers a powerful tool for efficient, data-driven literature reviews.

Installation

pip install litrevai

Basic Usage

Using LitRevAI typically follows these steps:

  1. Import Documents: Load documents, including metadata, from Zotero or other sources.
  2. Create a Project: Set up a new project to organize and analyze your literature review.
  3. Add Documents to the Project: Include the imported documents in the project for analysis.
  4. Create a Query: Formulate a query to retrieve relevant information from the documents.
  5. Run the Query: Apply the query across all documents in the project to gather responses.
  6. Refine or Analyze: Use the responses to either ask additional questions or generate a topic model.

RAG

from litrevai import LiteratureReview, YesNoPrompt, ListPrompt

# Access Database
lr = LiteratureReview('db')

# Import Documents from Zotero Personal Library
lr.import_zotero(filter_libraries=['Personal'])

# Create a project
project = lr.create_project(name='New Project')

# Add all items to the project
project.add_items(lr.items)

# Create a query using a YesNoPrompt
prog_query = project.create_query(
    name='programming',
    prompt=YesNoPrompt(
        question="Does the document report on a study or experiment involving programming?"
    )
)

# Run query over all documents in the project
prog_query.run()

print(prog_query.responses)

# Create another Query
concept_query = project.create_query(
    name='prog_concepts',
    prompt=ListPrompt(
        question="What programming concepts are mentioned in the document? List all of them!",
        n=10
    )
)

# Use the responses from the last query as a filter
concept_query.run(items=prog_query.as_filter())

print(concept_query.responses)

Topic Modelling

from litrevai import LiteratureReview, YesNoPrompt, ListPrompt

lr = LiteratureReview('db')

query = lr.queries['prog_concepts']

topic_model = query.create_topic_model()

topic_model.summary()

Large Language Models

To use Retrieval-Augmented Generation (RAG) or topic modeling in LitRevAI a large language model (LLM) is required. LitRevAI provides basic support for LLM inference via Huggingface and OpenAI. To enable these integrations, it’s recommended to store the required API keys either in an .env file within the working directory or in environment variables.

HF_TOKEN=""
OPENAI_API_KEY=""

Alternatively, you can pass them directly to the constructor:

from litrevai.llm import HuggingfaceModel, OpenAIModel

api_key = 'xy'
model = 'model_name_or_url'

model = HuggingfaceModel(api_key=api_key, model=model)
model = OpenAIModel(api_key=api_key, model=model)

License

litrevai is distributed under the terms of the MIT license.

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

litrevai-0.0.1.tar.gz (923.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litrevai-0.0.1-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file litrevai-0.0.1.tar.gz.

File metadata

  • Download URL: litrevai-0.0.1.tar.gz
  • Upload date:
  • Size: 923.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for litrevai-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1b89323de2b7707c250ab91e5152ed1ea3af85b468e3ca1e9ce4d14cc5025287
MD5 ae339d3b269dc64e9f643093547c0c15
BLAKE2b-256 57f06612a8644e4119a5cb102cfef9fc1ba108de79c84152c3f3f76d04e0bd11

See more details on using hashes here.

File details

Details for the file litrevai-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: litrevai-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.2

File hashes

Hashes for litrevai-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59a2795b5779c7f0c8ae70a0761ece33ff060754ee69039e7896636adff843ce
MD5 3226ba1b4a25cb60baa3970c6bfaac5e
BLAKE2b-256 b58f9538e40cac9a2f71167d1d155e51e817d74ffccb2fdbe3845916d330ad35

See more details on using hashes here.

Supported by

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