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.