Skip to content

Add contract_risk analyzer template for contractual risk extraction - #139

Open
DB API Builder (dbapibuilder) wants to merge 1 commit into
Azure-Samples:mainfrom
dbapibuilder:feature/add-contract-risk-analyzer
Open

Add contract_risk analyzer template for contractual risk extraction#139
DB API Builder (dbapibuilder) wants to merge 1 commit into
Azure-Samples:mainfrom
dbapibuilder:feature/add-contract-risk-analyzer

Conversation

@dbapibuilder

Copy link
Copy Markdown
## Purpose
Adds a new `contract_risk.json` analyzer template for Azure AI Content Understanding to help users analyze commercial contracts. It extracts core party details (buyer/seller, dates, contract value) and identifies contractual risk points with severity, affected party, clause reference, and mitigation suggestions — enabling automated contract risk review at scale.

## Does this introduce a breaking change?

[ ] Yes
[x] No


## Pull Request Type

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:


## How to Test
* Get the code

git clone https://github.com/dbapibuilder/azure-ai-content-understanding-python
cd azure-ai-content-understanding-python
git checkout feature/add-contract-risk-analyzer
pip install -r requirements.txt


* Test the code

1. Configure your Azure AI Content Understanding endpoint and key in `.env`.
2. Open `notebooks/field_extraction.ipynb`.
3. Set the analyzer template path to `analyzer_templates/contract_risk.json`.
4. Run the notebook against a sample commercial contract (PDF or DOCX).
5. Confirm the notebook completes without errors and returns structured JSON output.

## What to Check
* `ContractType` is classified into one of: Sales, Service, Purchase, Supply, NDA, MSA, SOW, Lease, Employment, Other
* `OverallRiskLevel` returns one of: Low, Medium, High, Critical
* `RiskPoints` array items each contain: `RiskCategory`, `RiskTitle`, `RiskDescription`, `AffectedParty`, `Severity`, `ClauseReference`, `MitigationSuggestion`
* `KeyObligations` correctly identifies obligations and the responsible party
* `MissingOrAmbiguousTerms` surfaces vague or absent clauses
* Existing analyzer templates are unaffected

## Other Information
New analyzer template file: `analyzer_templates/contract_risk.json`

Fields introduced: `ContractTitle`, `ContractNumber`, `ContractType`, `BuyerCompanyName`, `SellerCompanyName`, `BuyerAddress`, `SellerAddress`, `EffectiveDate`, `ExecutionDate`, `ExpirationDate`, `AutoRenewal`, `Currency`, `ContractValue`, `PaymentTerms`, `GoverningLaw`, `TerminationNoticePeriod`, `LiabilityCap`, `OverallRiskLevel`, `RiskSummary`, `RiskPoints`, `KeyObligations`, `MissingOrAmbiguousTerms`

@dbapibuilder

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants