An application that leverages DocuSign, OpenAI, Microsoft semantic-kernel and Neo4j to provide intelligent contract analysis and a context-aware chatbot interface.
Watch the full demo on YouTube
- DocuSign Integration: Seamless OAuth2 authentication and document retrieval using Docusign eSignature REST API
- Intelligent Processing: Automated contract analysis using OpenAI's assistant api and Microsoft's Semantic Kernel
- Real-time Updates: Webhook-based progress tracking for background tasks
- Graph-based Knowledge: Neo4j-powered contract relationship mapping
- Interactive Chat: Context-aware contract query system
- Next.js
- ShadcN UI
- Tailwind
- Webhooks: Real-time progress updates
- FastAPI
- Microsoft Semantic Kernel: Advanced LLM integration
- OpenAI
- Neo4j: Graph database for contract relationships
- Docusign eSignature REST API: Document handling and OAuth2
.
βββ apps/
β βββ frontend/ # Next.js frontend application
β βββ backend/ # FastAPI backend application
βββ package.json # Root package.json for monorepo
βββ pnpm-workspace.yaml # PNPM workspace configuration
.
βββ api/ # API routes and endpoints
βββ core/ # Core application logic and configurations
βββ data/ # Database interactions (can be moved to a cloud storage)
βββ schemas/ # Schemas and validators
βββ services/ # Business logic services
β βββ ai/ # AI-related services
β β βββ llm/ # Language model implementations
β β βββ neo4j/ # Neo4j database services
β β βββ orchestration/ # Service orchestration logic
β β βββ prompts/ # LLM prompt templates
β βββ document/ # Document processing services
β β βββ stream.py # Document streaming functionality
β β βββ downloader.py # Document download handlers
β βββ docusign/ # DocuSign integration services
β β βββ auth.py # Authentication handlers
β β βββ envelope.py # Envelope management
β βββ notification/ # Notification services
β β βββ webhook.py # Webhook handlers
β βββ tracking/ # Progress tracking services
β βββ batch_progress.py # Batch progress tracking
β βββ progress.py # General progress tracking
βββ utils/ # Utility functions and helpers
-
Authentication
- OAuth2-based DocuSign login
- Access token and account ID retrieval
-
Document Processing
- Downloads completed agreements (past 3 days)
- Converts PDFs to structured JSON
- Builds graph relationships
-
Analysis Features
- Contract parties identification
- Risk assessment
- Obligation tracking
- Governing law analysis
- Industry pattern recognition
The system includes a sophisticated chatbot that:
- Leverages graph database for contextual awareness
- Provides precise contract-specific answers
- Understands relationships between different agreements
- Offers insights based on historical patterns
GET /login # Initiate DocuSign OAuth flow
GET /callback # Handle OAuth callback
POST /chat/ # Send message and get AI response
DELETE /chat/history # Clear chat history for current user
GET /envelopes/ # Get completed envelopes and trigger processing
GET /envelopes/json_files # Get processed JSON files
GET /envelopes/{envelope_id}/documents # List envelope documents
GET /envelopes/{envelope_id}/documents/{document_id}/download # Download document
- PNPM package manager
- Poetry (Python dependency management)
cd docusign-contract-analysis
# Install dependencies (both frontend and backend)
pnpm run monorepo-setup
# Set up environment variables
cp apps/backend/.env.example apps/backend/.env
cp apps/frontend/.env.example apps/frontend/.env
# Start development servers
pnpm run dev # Starts both frontend and backend servers
see .env.example
inside
- apps/frontend/
- apps/backend/
This project is licensed under the MIT License - see the LICENSE file for details.