Skip to main content

A RAG system for contract analysis

Project description

Contract Analyzer

This package provides a RAG system for contract analysis using the Meta-Llama-3-8B-Instruct model.

Installation

You can install the package using pip:

pip install contract-analyzer

Usage

Here's a basic example of how to use the ContractAnalysisRAG system:

from huggingface_hub import login
from contract_analyzer import ContractAnalysisRAG

# Authenticate with Hugging Face
token = "your_huggingface_token_here"
model_name = "meta-llama/Meta-Llama-3-8B-Instruct"
login(token=token)

# Initialize the RAG system
rag_system = ContractAnalysisRAG(
    max_chunk_size=100,
    overlap=50,
    min_chunk_size=50,
    top_k=3,
    use_semantic_search=True,
    model_id=model_name,
    max_new_tokens=512,
    temperature=0.7
)

# Add your PDF documents
pdf_paths = ['path/to/your/contract.pdf']
rag_system.add_pdf_documents(pdf_paths)

# Example query
query = "Who is the employee named in the contract?"

# Retrieve the most relevant chunk and generate a response
most_related_chunk = rag_system.retrieve_and_print(query)
if most_related_chunk:
    response = rag_system.generate(query, [most_related_chunk])
    print(f"Query: {query}")
    print(f"Generated Response: {response}")
else:
    print("No relevant information found.")

Note: Replace 'your_huggingface_token_here' with your actual Hugging Face token to access the Meta-Llama-3-8B-Instruct model.

Features

  • PDF document processing
  • Semantic search for relevant information retrieval
  • Integration with Meta-Llama-3-8B-Instruct model for response generation
  • Customizable chunking and retrieval parameters

Requirements

  • Python 3.7+
  • Hugging Face account with access to the Meta-Llama-3-8B-Instruct model

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

contract_analyzer-0.2.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

contract_analyzer-0.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file contract_analyzer-0.2.0.tar.gz.

File metadata

  • Download URL: contract_analyzer-0.2.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for contract_analyzer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fbec38c59acca557b8b450696de752f3643ee6cbdf6782f963f220577b882010
MD5 5c67b53b3d2ccdee3d9559684df21b7f
BLAKE2b-256 2596803b4f3329050709a861a9fc457df099458209726fbf0a9ca67f685172d3

See more details on using hashes here.

File details

Details for the file contract_analyzer-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for contract_analyzer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 daa24c645d768c48a10eae1fdc32c5a56fa2564fbef93defc72936dd216e51aa
MD5 bd9266891cce6b4faee80a10abbaeb8d
BLAKE2b-256 16b23adc3db3590cfdd27efb75da8926d0d7f265acb81f48345e2141f11ec587

See more details on using hashes here.

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