Skip to content

Submission by The Nomads #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions usecase/document-based-application/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# General
.env

# Node.js
/node_modules
/frontend/node_modules

# Next.js
/.next/
/out/
/frontend/.next

# Production Build
/build

# Debug Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# TypeScript
*.tsbuildinfo
next-env.d.ts

# Vercel
.vercel

# Miscellaneous
*.pyc

126 changes: 101 additions & 25 deletions usecase/document-based-application/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
> 📢 **Notice:**
> All teams submitting their project must create a `README.md` file following this guideline.
> Please make sure to replace all placeholder texts (e.g., [Project Title], [Describe feature]) with actual content.

# 🛠️ [Project Title]
# 📄 DocZilla

### 📌 Overview
This project was developed as part of the Document Based Application Hackathon. It aims to solve [describe the problem or goal].
This project was developed as part of the AGI Agent Application Hackathon. It aims to solve the challenge of understanding, verifying, and summarizing documents (such as contracts or policies) using an LLM-powered agent, enabling automated compliance checks, summarization, and intelligent extraction of insights.

### 🚀 Key Features
- ✅ **Feature 1**: [Describe feature]
- ✅ **Feature 2**: [Describe feature]
- ✅ **Feature 3**: [Describe feature]
- ✅ **Document Upload & Parsing**: Admins and users can upload documents which are parsed, summarized, or checked against internal policies.
- ✅ **Slack Notification**: Automatically generates a summary of the latest uploaded document and sends it to a Slack channel via webhook.
- ✅ **Compliance Checklist Extraction**: Parses internal policy documents and uses the LLM to extract a structured, testable checklist to compare against future contracts.
### Demo 🎉
Experience the project in action with our live demo. Click the link below for a guided walkthrough showcasing document upload, parsing, compliance checklist extraction, and Slack integration.

[Watch Live Demo](https://example.com/demo)

![pic1](/screenshots/pic1.jpg)

![pic2](/screenshots/pic2.jpg)

![pic3](/screenshots/pic3.jpg)

[Watch Demo Video](https://drive.google.com/file/d/16xkGJr7-6aurjEV-tFU9HOB-LRJxrJI7/view?usp=sharing)

### 🧩 Tech Stack
- **Frontend**: Next.js, Tailwind CSS
- **Backend**: FastAPI
- **Database**: FAISS (vector database)
- **Others**: OpenAI API (solar-pro via Upstage), LangChain, Slack Webhooks

### 🏗️ Project Structure

### 🖼️ Demo / Screenshots
![screenshot](./screenshot.png)
[Optional demo video link: e.g., YouTube]

### 🧩 Tech Stack
- **Frontend**: [e.g., React, Vue, HTML/CSS]
Expand All @@ -24,19 +37,81 @@ This project was developed as part of the Document Based Application Hackathon.

### 🏗️ Project Structure
```
📁 project-name/
📁 The-Nomads/
├── frontend/
│ ├── components.json # Central config for UI component references.
│ ├── next.config.mjs # Next.js custom configuration settings.
│ ├── package-lock.json # Auto-generated lockfile for npm dependency versions.
│ ├── package.json # Project metadata and frontend dependencies.
│ ├── tailwind.config.ts # Tailwind CSS theme and utility configuration.
│ ├── tsconfig.json # TypeScript compiler options and path aliases.
│ ├── app/
│ │ ├── globals.css # Global styles applied across the entire app.
│ │ ├── layout copy.tsx # Backup or experimental layout file.
│ │ ├── layout.tsx # Root layout component for consistent app structure.
│ │ ├── page.tsx # Landing page of the application.
│ │ ├── dashboard/
│ │ │ └── page.tsx # User dashboard displaying chat interface and uploads.
│ │ └── pricing/
│ │ └── page.tsx # Pricing page showing subscription plans.
│ ├── components/
│ │ ├── action-panel.tsx # Button panel for user interactions.
│ │ ├── action-sidebar.tsx # Sidebar showing actions or document options.
│ │ ├── app-sidebar.tsx # Main app sidebar for navigation.
│ │ ├── chat-interface.tsx # Main component for displaying chat sessions.
│ │ ├── chat-panel.tsx # Panel to display chat messages and input field.
│ │ ├── file-uploader.tsx # Component for uploading policy and contract files.
│ │ ├── landing-page.tsx # Component structuring the homepage content.
│ │ ├── login-form.tsx # Authentication form for login.
│ │ ├── signup-form.tsx # Authentication form for new user registration.
│ │ ├── theme-provider.tsx # Context for dark/light mode and theme settings.
│ │ ├── pricing/
│ │ │ ├── pricing-cards.tsx # Reusable pricing plan cards.
│ │ │ ├── pricing-header.tsx # Header text and layout for pricing section.
│ │ │ └── pricing-toggle.tsx # Toggle between monthly/yearly billing.
│ │ └── ui/ # Shared low-level UI components (e.g., buttons, modals).
│ ├── hooks/ # Custom React hooks for managing state and logic.
│ ├── lib/ # Helper functions and client-side utilities.
│ ├── public/ # Static files like logos, icons, etc.
│ ├── services/
│ │ ├── chat.ts # API handler for sending/receiving chat messages.
│ │ └── upload.ts # API handler for file upload requests.
│ ├── styles/
│ │ └── globals.css # Duplicate reference for styling, used by legacy files.
│ └── types/
│ └── chat.ts # Type definitions related to chat message objects.
├── backend/
├── assets/
├── README.md
└── ...
│ ├── main.py # FastAPI app
│ ├── routes/
│ │ ├── upload.py # uploading documents to be parsed and then stored in the vector database
│ │ ├── query.py # embedding the query (prompt), and compare it to the vectore database using cosine similarity
│ │ ├── chat.py # managing the session connection between the user and the LLM
│ │ ├── slack.py # summarizing the document and send the summary to slack
│ │ └── policy.py # uploading the internal policy to the database and checking the contracts against it
│ ├── utils/
│ │ ├── parse.py # Upstage API helper for parsing docs
│ │ ├── ocr.py # Upstage API helper for ocr images
│ │ ├── embedding.py # converting string to vector representations (embeddings)
│ │ ├── chunk.py # dividing the big documents into smaller, relatable parts, utilizing metadata
│ │ ├── llm.py # managing chat sessions while keeping the history
│ │ └── retrieve.py # comparing the queries to the vectors in the database and retrieve the most similar ones
│ ├── vector_store/
│ │ ├── embedding_store.pkl # saved FAISS index
│ │ └── latest_document.pkl # keeping track of the latest added document (is overwritten every time we upload)
│ ├── schemas/
│ │ └── chat_payload.py # pydantic model for the chat session object
│ ├── data/
│ │ ├── policy_checklist.txt # the extracted checklist from the policy
│ │ └── latest_document.txt # the parsed data from the latest document
│ └── .env # UPSTAGE_API_KEY, etc.
└── README.md
```

### 🔧 Setup & Installation

```bash
# Clone the repository
git clone https://github.com/UpstageAI/cookbook/usecase/agi-agent-application/[repo-name].git
git clone https://github.com/M-Abdelhakem/the-nomads.git

# Move to the frontend directory and run
cd frontend
Expand All @@ -46,28 +121,29 @@ npm run dev
# Move to the backend directory and run
cd backend
pip install -r requirements.txt
python app.py
uvicorn main:app --reload
```

### 📁 Dataset & References
- **Dataset used**: [source and brief explanation]
- **Dataset used**: We generated mock data to simulate some of the usecases we tackled
- **References / Resources**:
[link 1]
[link 2]
[Internal Policy](https://docs.google.com/document/d/1XjfkSbxQ71sWHhwZoj0pSUSvL26ohWWMSRlrKMtejeE/edit?usp=sharing)
[Contract 1](https://docs.google.com/document/d/15c5c4Q74BrJIYqFnrnuER_DL_DUXL1kRM2-6qZOUvFk/edit?usp=sharing)
[Contract 2](https://docs.google.com/document/d/1YufhygMcE5dVumpEL7naMiaBGG6DSTW3HV1vMPWIKKs/edit?usp=sharing)

### 🙌 Team Members

| Name | Role | GitHub |
|-------------|--------------------|------------------------------------|
| Kim Ups | Frontend Developer | [@kimups](https://github.com/johndoe) |
| Park Stage | Backend Developer | [@parkstage](https://github.com/janedev) |
| Mohanad Abdelhakem | Full-Stack Developer | [@M-Abdelhakem](https://github.com/M-Abdelhakem) |
| Madiyar Zhunussov | Full-Stack Developer | [@madiyarzm](https://github.com/madiyarzm) |

### ⏰ Development Period
- Last updated: YYYY-MM-DD
- Last updated: 2025-04-13

### 📄 License
This project is licensed under the [MIT license](https://opensource.org/licenses/MIT).
See the LICENSE file for more details.

### 💬 Additional Notes
- Feel free to include any other relevant notes or links here.
- Feel free to include any other relevant notes or links here.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{'api': '2.0', 'content': {'html': "<p id='0' data-category='paragraph' style='font-size:20px'>INTERNAL POLICY</p>\n<p id='1' data-category='paragraph' style='font-size:18px'>Effective Date: March 1, 2025 Last reviewed by Legal: March 1, 2025<br>All contracts executed between NorthBeam Solutions and third-party vendors must<br>adhere to these guidelines:</p>\n<br><h1 id='2' style='font-size:20px'>1. Payment Terms</h1>\n<p id='3' data-category='list' style='font-size:16px'>· Initial upfront payment must not exceed 30% of the total contract value.<br>· Remaining payments must be tied explicitly to deliverables or milestones.</p>\n<p id='4' data-category='paragraph' style='font-size:18px'>2. Contract Duration and Renewal</p>\n<p id='5' data-category='list' style='font-size:16px'>· Maximum initial contract duration: 24 months.<br>● No auto-renewals; explicit written renewal required at least 90 days prior to<br>contract expiration.</p>\n<h1 id='6' style='font-size:18px'>3. Liability & Insurance</h1>\n<p id='7' data-category='paragraph' style='font-size:18px'>Vendor must maintain a liability insurance policy of at least $1,000,000 USD<br>coverage for the duration of the contract.</p>\n<h1 id='8' style='font-size:20px'>4. Confidentiality & Data Security</h1>\n<p id='9' data-category='list' style='font-size:18px'>· Contract must include clauses prohibiting reverse engineering and unauthorized<br>disclosure of confidential information.<br>● Vendor must comply with NorthBeam Corporation's data protection standards<br>(ISO 27001 compliant).</p>\n<h1 id='10' style='font-size:20px'>5. Dispute Resolution</h1>\n<p id='11' data-category='list' style='font-size:20px'>Contracts must specify mediation as the first step of dispute resolution.<br>Arbitration, if needed, must take place in New York State under American<br>Arbitration Association (AAA) rules.</p>\n<p id='12' data-category='paragraph' style='font-size:18px'>Internal Policy</p>\n<br><footer id='13' style='font-size:14px'>1</footer>", 'markdown': '', 'text': ''}, 'elements': [{'category': 'paragraph', 'content': {'html': "<p id='0' data-category='paragraph' style='font-size:20px'>INTERNAL POLICY</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.4036, 'y': 0.0915}, {'x': 0.5977, 'y': 0.0915}, {'x': 0.5977, 'y': 0.1097}, {'x': 0.4036, 'y': 0.1097}], 'id': 0, 'page': 1}, {'category': 'paragraph', 'content': {'html': "<p id='1' data-category='paragraph' style='font-size:18px'>Effective Date: March 1, 2025 Last reviewed by Legal: March 1, 2025<br>All contracts executed between NorthBeam Solutions and third-party vendors must<br>adhere to these guidelines:</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1128, 'y': 0.1454}, {'x': 0.8473, 'y': 0.1454}, {'x': 0.8473, 'y': 0.2214}, {'x': 0.1128, 'y': 0.2214}], 'id': 1, 'page': 1}, {'category': 'heading1', 'content': {'html': "<br><h1 id='2' style='font-size:20px'>1. Payment Terms</h1>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1131, 'y': 0.2295}, {'x': 0.2793, 'y': 0.2295}, {'x': 0.2793, 'y': 0.248}, {'x': 0.1131, 'y': 0.248}], 'id': 2, 'page': 1}, {'category': 'list', 'content': {'html': "<p id='3' data-category='list' style='font-size:16px'>· Initial upfront payment must not exceed 30% of the total contract value.<br>· Remaining payments must be tied explicitly to deliverables or milestones.</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1425, 'y': 0.2702}, {'x': 0.8208, 'y': 0.2702}, {'x': 0.8208, 'y': 0.3193}, {'x': 0.1425, 'y': 0.3193}], 'id': 3, 'page': 1}, {'category': 'paragraph', 'content': {'html': "<p id='4' data-category='paragraph' style='font-size:18px'>2. Contract Duration and Renewal</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1139, 'y': 0.344}, {'x': 0.4271, 'y': 0.344}, {'x': 0.4271, 'y': 0.3637}, {'x': 0.1139, 'y': 0.3637}], 'id': 4, 'page': 1}, {'category': 'list', 'content': {'html': "<p id='5' data-category='list' style='font-size:16px'>· Maximum initial contract duration: 24 months.<br>● No auto-renewals; explicit written renewal required at least 90 days prior to<br>contract expiration.</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1417, 'y': 0.3855}, {'x': 0.8397, 'y': 0.3855}, {'x': 0.8397, 'y': 0.4618}, {'x': 0.1417, 'y': 0.4618}], 'id': 5, 'page': 1}, {'category': 'heading1', 'content': {'html': "<h1 id='6' style='font-size:18px'>3. Liability & Insurance</h1>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.113, 'y': 0.4855}, {'x': 0.3327, 'y': 0.4855}, {'x': 0.3327, 'y': 0.5053}, {'x': 0.113, 'y': 0.5053}], 'id': 6, 'page': 1}, {'category': 'paragraph', 'content': {'html': "<p id='7' data-category='paragraph' style='font-size:18px'>Vendor must maintain a liability insurance policy of at least $1,000,000 USD<br>coverage for the duration of the contract.</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1422, 'y': 0.5277}, {'x': 0.8385, 'y': 0.5277}, {'x': 0.8385, 'y': 0.5762}, {'x': 0.1422, 'y': 0.5762}], 'id': 7, 'page': 1}, {'category': 'heading1', 'content': {'html': "<h1 id='8' style='font-size:20px'>4. Confidentiality & Data Security</h1>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1132, 'y': 0.6006}, {'x': 0.4255, 'y': 0.6006}, {'x': 0.4255, 'y': 0.6197}, {'x': 0.1132, 'y': 0.6197}], 'id': 8, 'page': 1}, {'category': 'list', 'content': {'html': "<p id='9' data-category='list' style='font-size:18px'>· Contract must include clauses prohibiting reverse engineering and unauthorized<br>disclosure of confidential information.<br>● Vendor must comply with NorthBeam Corporation's data protection standards<br>(ISO 27001 compliant).</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1436, 'y': 0.6417}, {'x': 0.8809, 'y': 0.6417}, {'x': 0.8809, 'y': 0.7454}, {'x': 0.1436, 'y': 0.7454}], 'id': 9, 'page': 1}, {'category': 'heading1', 'content': {'html': "<h1 id='10' style='font-size:20px'>5. Dispute Resolution</h1>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1138, 'y': 0.7702}, {'x': 0.316, 'y': 0.7702}, {'x': 0.316, 'y': 0.7893}, {'x': 0.1138, 'y': 0.7893}], 'id': 10, 'page': 1}, {'category': 'list', 'content': {'html': "<p id='11' data-category='list' style='font-size:20px'>Contracts must specify mediation as the first step of dispute resolution.<br>Arbitration, if needed, must take place in New York State under American<br>Arbitration Association (AAA) rules.</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1424, 'y': 0.8115}, {'x': 0.8275, 'y': 0.8115}, {'x': 0.8275, 'y': 0.8876}, {'x': 0.1424, 'y': 0.8876}], 'id': 11, 'page': 1}, {'category': 'paragraph', 'content': {'html': "<p id='12' data-category='paragraph' style='font-size:18px'>Internal Policy</p>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.1145, 'y': 0.9157}, {'x': 0.2138, 'y': 0.9157}, {'x': 0.2138, 'y': 0.9305}, {'x': 0.1145, 'y': 0.9305}], 'id': 12, 'page': 1}, {'category': 'footer', 'content': {'html': "<br><footer id='13' style='font-size:14px'>1</footer>", 'markdown': '', 'text': ''}, 'coordinates': [{'x': 0.8717, 'y': 0.9322}, {'x': 0.8862, 'y': 0.9322}, {'x': 0.8862, 'y': 0.9459}, {'x': 0.8717, 'y': 0.9459}], 'id': 13, 'page': 1}], 'merged_elements': [], 'model': 'document-parse-250116', 'ocr': True, 'usage': {'pages': 1}}
Loading