Skip to main content

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

Metadata

Release files for contract-analyzer 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for contract-analyzer 0.2.0
File Size Uploaded
contract_analyzer-0.2.0.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for contract-analyzer 0.2.0
File Interpreter ABI Platform
contract_analyzer-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / contract_analyzer-0.2.0.tar.gz

Download URL contract_analyzer-0.2.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fbec38c59acca557b8b450696de752f3643ee6cbdf6782f963f220577b882010
BLAKE2b-256 checksum
How to use checksums
2596803b4f3329050709a861a9fc457df099458209726fbf0a9ca67f685172d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / contract_analyzer-0.2.0-py3-none-any.whl

Download URL contract_analyzer-0.2.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
daa24c645d768c48a10eae1fdc32c5a56fa2564fbef93defc72936dd216e51aa
BLAKE2b-256 checksum
How to use checksums
16b23adc3db3590cfdd27efb75da8926d0d7f265acb81f48345e2141f11ec587
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page