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)
| File | Size | Uploaded | |
|---|---|---|---|
| contract_analyzer-0.2.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|