Skip to content

Commit 7cccc85

Browse files
authored
Merge pull request #85 from mikebudzynski/sk-agents-cu
Semantic Kernel agents: Content Understanding and SOP Forge
2 parents 7836715 + c0552b3 commit 7cccc85

40 files changed

+1558
-121
lines changed
Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,67 @@
1-
# Contract Analysis Agent
1+
# Contract Analysis Agent Using Azure AI Agent Service And Semantic Kernel
22

3-
## Overview
3+
## Overview
44

5-
The Contract Analysis agent code sample enables creating agents that compare contract versions by evaluating changes between them. It assists in reviewing multiple versions of a contract by evaluating the changes between them. extracts key fields and clauses from the contracts, highlights differences, and generates a detailed report that highlights the differences. The report is formatted in markdown to clearly identify these differences and mirrors the structure of the contracts to ensure readability, making it easy for the reviewer to understand all changes.
5+
The Contract Analysis agent, implemented with Azure AI Agent Service and Semantic Kernel, reviews multiple versions of a contract and generates a detailed and structured report that highlights the differences. The Markdown report mirrors the structure of the contracts to ensure readability and makes it easy for the reviewer to understand the differences.
66

7-
The agent performs the following:
7+
The agent's capabilities include:
88

9-
- **Contract Comparison**: Compare two versions of a contract to identify changes in key fields and clauses. Use specialized tools and techniques to extract relevant information.
10-
- **Report Generation**: Generate a detailed report on the differences between the two versions of the contract. Format reports using markdown to ensure clarity and readability. Organize content with headings, subheadings, bullet points, and numbered lists.
11-
- **Communication**: Communicate findings to the reviewer in a clear and concise manner. Identify the next actions for the reviewer.
9+
* **Contract Comparison**: Compares two versions of a contract to identify changes in key fields and clauses. Uses specialized tools and techniques to extract relevant information from them.
10+
* **Report Generation**: Generates a detailed report on the differences between the two versions of a contract. Formats reports using Markdown to ensure clarity and readability. Organizes content with headings, subheadings, bullet points, and numbered lists.
11+
* **Communication**: Communicates findings to the reviewer in a clear and concise manner.
1212

13-
The agent uses the following tools:
13+
This Azure AI Agent Service agent uses the Azure AI Content Understanding for transcription of PDF contacts to markdown, contract analysis, and content extraction.
1414

15-
- **Azure Content Understanding**: Contract analysis, content extraction, field extraction.
16-
- **File Search**: Pull user-provided additional documents or brand guides.
15+
## Sample Data
1716

18-
## Getting Started
17+
Example of the Standard Operating Procedure generated by the agent is located in the [assets folder](assets/output/sample_output.md). This response was generated from sample contracts located in [the input folder](assets/input).
1918

20-
TBD
19+
## Getting Started
2120

2221
### Prerequisites
2322

23+
* [Python](https://www.python.org/downloads/)
24+
2425
### Instructions
2526

26-
### Sample Data
27+
#### Step 1: Create Azure AI Content Understanding Resource
28+
29+
[Follow the official documentation](https://learn.microsoft.com/azure/ai-services/content-understanding/how-to/create-multi-service-resource) to create an Azure AI Services resource that supports Content Understanding.
30+
31+
#### Step 2: Create Deployment Model
32+
33+
[Follow the official documentation](https://learn.microsoft.com/azure/ai-foundry/quickstarts/get-started-playground#deploy-a-chat-model) to create an Azure AI Foundry model deployment.
34+
35+
#### (Optional) Step 3: Create Azure AI Agent Service Agent
36+
37+
*This step is optional. If you don't create an Azure AI Agent, the program will create one for you automatically.*
38+
39+
1. Follow the official [Azure AI Agent Service documentation](https://learn.microsoft.com/azure/ai-services/agents/quickstart?pivots=ai-foundry-portal) to create the claims analysis agent (a chat completion agent).
40+
2. In the **Instructions** box, paste the contents of [AgentInstructions.md file](assets/input/AgentInstructions.md).
41+
42+
#### Step 4: Configure `.env` File
43+
44+
Duplicate the `src/.env.example` file as `src/.env` and provide the required configuration.
45+
46+
#### Step 5: Install Required Modules
47+
48+
Run the following command to install modules used by the application:
49+
50+
```sh
51+
pip install -r requirements.txt
52+
```
53+
54+
#### Step 6: Run Agent
55+
56+
Launch the application:
57+
58+
```sh
59+
python src/template.py
60+
```
61+
62+
## Resources
63+
64+
- Semantic Kernel [documentation](https://learn.microsoft.com/semantic-kernel/overview/) and [GitHub repo with source code](https://github.com/microsoft/semantic-kernel)
65+
- [Azure AI Agent Service documentation](https://learn.microsoft.com/azure/ai-services/agents/)
66+
- [Azure AI Content Understanding documentation](https://learn.microsoft.com/azure/ai-services/content-understanding/)
67+
- [Azure AI Foundry documentation](https://learn.microsoft.com/azure/ai-foundry/)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You are responsible for comparing different versions of a contract, extracting key fields and clauses, and generating detailed reports on the changes. This role requires a keen eye for detail, strong analytical skills, and the ability to communicate findings clearly and concisely. Make sure to analyze the contracts thoroughly. The contracts are formatted in markdown in a user's prompt. Generate the response with differences in a markdown format.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"scenario": "document",
3+
"fieldSchema": {
4+
"fields": {
5+
"Summary": {
6+
"type": "string",
7+
"method": "generate",
8+
"description": "Generate the summary of this contract with names of the parties, dates and any contract values"
9+
},
10+
"Article": {
11+
"type": "array",
12+
"items": {
13+
"type": "object",
14+
"properties": {
15+
"ArticleName": {
16+
"type": "string",
17+
"method": "extract",
18+
"description": "Name of the article listed as Article4:Contracting Out, and so on"
19+
}
20+
},
21+
"method": "extract"
22+
},
23+
"method": "generate",
24+
"description": "List of all the articles in the document"
25+
},
26+
"Sections": {
27+
"type": "string",
28+
"method": "classify",
29+
"description": "Sections of the Contract",
30+
"enum": [
31+
"Preamble",
32+
"Article"
33+
],
34+
"enumDescriptions": {
35+
"Preamble": "Preamble",
36+
"Article": "Article"
37+
}
38+
}
39+
},
40+
"definitions": {}
41+
}
42+
}
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
## Comparative Analysis Report: 123 Logistics Contract vs. ABC Transit Contract
2+
3+
This detailed comparative report outlines key differences between the two collective bargaining agreements (CBAs) provided. Each section identifies distinctions in key fields and clauses.
4+
5+
---
6+
7+
### **1. Preamble**
8+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
9+
|-----------------------------|--------------------------|--------------------|
10+
| Acknowledges mutual commitments to efficient operations and emphasizes collaboration between labor and management. | Emphasis on fostering cooperation between labor and management without detailed mutual commitments to operational efficiency. | Greater emphasis on efficiency in the 123 Logistics Contract compared to ABC. |
11+
12+
---
13+
14+
### **2. Recognition**
15+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
16+
|-----------------------------|--------------------------|--------------------|
17+
| Covers Maintenance Technicians, Vehicle Repair Technicians, Facilities Maintenance Staff. | Covers Mechanics, Equipment Body Repair, Fuelers, Washer/Cleaners, Equipment Service Workers, Facilities Maintenance Workers, and Facilities Support Specialists. | Broader scope in ABC Transit, including more job classifications. |
18+
| Bargaining unit is defined as employees working 20+ hours/week. | Bargaining unit includes employees working less than 24 hours/week. | ABC Transit defines part-time as <24 hours, while 123 Logistics uses a 20-hour threshold. |
19+
| Management personnel may temporarily perform bargaining unit work (provided it’s incidental or unavoidable). | Management personnel retain the right to perform bargaining unit work, including during emergencies. | Broader management rights outlined in ABC Transit CBA. |
20+
21+
---
22+
23+
### **3. Management Rights**
24+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
25+
|-----------------------------|--------------------------|--------------------|
26+
| Includes detailed rights to alter and enforce operational policies and emergency actions. Emergency definition is detailed. | Similar provisions but with less specificity regarding emergency definitions and decision-making processes. | 123 Logistics provides more structured definitions and processes for emergencies. |
27+
| Requires notification for changes to personnel rules/policies through written, electronic, or posted means. | Changes may be communicated orally or in writing. | 123 Logistics has stricter communication methods. |
28+
29+
---
30+
31+
### **4. Union Membership**
32+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
33+
|-----------------------------|--------------------------|--------------------|
34+
| Employees must join the Union or submit a written declination within 30 days of hire. | Union membership allowed within 45 days of hire. | ABC Transit offers a longer timeframe for Union membership. |
35+
| Deduction of Union dues is revocable and voluntary. | Deduction of Union dues requires a written request but is not noted as revocable. | Logistics explicitly acknowledges dues revocation. |
36+
37+
---
38+
39+
### **5. Contracting Out**
40+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
41+
|-----------------------------|--------------------------|--------------------|
42+
| Prohibits contracting out if it results in permanent layoffs or reduced hours. Exceptions include historical precedent and specialization requirements. | Prohibits contracting out if layoffs occur but explicitly allows historical contracting out without conditions. | ABC Transit provides less conditional protection for bargaining unit work. |
43+
| Requires Union consultation for subcontracting impacts. | Provides Union an opportunity to participate in discussions but retains sole decision authority. | 123 Logistics consults with unions in good faith, while ABC limits Union influence. |
44+
45+
---
46+
47+
### **6. Non-Discrimination**
48+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
49+
|-----------------------------|--------------------------|--------------------|
50+
| Includes protections for gender identity, sexual orientation, veteran status, genetic information. | Protects based on race, creed, color, sex, religion, age, marital status, physical handicap. | 123 Logistics provides broader protections for diverse categories. |
51+
52+
---
53+
54+
### **7. Probationary Employees**
55+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
56+
|-----------------------------|--------------------------|--------------------|
57+
| Probationary period lasts 1,000 working hours. | Probationary period lasts 900 working hours. | 123 Logistics has a longer probationary period. |
58+
| Provides notification within 5 business days of successful completion of probation. | Provides notification upon completion but with no timeline mentioned. | Clearer probation completion communication in 123 Logistics with stricter timelines. |
59+
60+
---
61+
62+
### **8. Hours of Work/Overtime**
63+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
64+
|-----------------------------|--------------------------|--------------------|
65+
| Overtime is offered by seniority on a rotating basis with a formal weekly sign-up sheet. | Overtime is distributed by seniority but uses a Monday sign-up process without specific posting times. | 123 Logistics offers more structured overtime processes. |
66+
| Employees need a minimum 12-hour rest period (unless waived). | Employees need an 8-hour rest period (cannot waive). | Longer mandatory rest periods in 123 Logistics, with added flexibility. |
67+
| Call-back pay is set at a minimum of 4 hours. | Call-back pay is set at a minimum of 3 hours. | Higher compensation for call-back in 123 Logistics. |
68+
| Shift differentials: Swing Shift = $0.95/hour; Graveyard = $1.30/hour. | Shift differentials: Swing Shift = $0.60/hour; Graveyard = $1.25/hour. | 123 Logistics has higher shift differential rates. |
69+
70+
---
71+
72+
### **9. Continuity of Service**
73+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
74+
|-----------------------------|--------------------------|--------------------|
75+
| Service adjustments for unpaid leave exceeding 45 days or medical leave over 26 weeks. | Same as 123 Logistics. | Identical provisions in both agreements. |
76+
77+
---
78+
79+
### **10. Seniority/Layoff/Recall**
80+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
81+
|-----------------------------|--------------------------|--------------------|
82+
| Provides 14 days’ layoff notice, bumping rights, 12-month recall rights, and certified recall notices. | Provides 2 weeks’ layoff notice, bumping rights, 12-month recall rights, and certified recall notices. | Both agreements are largely similar, but 123 Logistics explicitly mentions more detailed processes for posting notices. |
83+
84+
---
85+
86+
### **11. Job Openings and Training**
87+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
88+
|-----------------------------|--------------------------|--------------------|
89+
| Shift bidding occurs annually, with specific deadlines (February). | Shift bidding occurs twice a year (February and August). | ABC allows semi-annual bidding, offering more frequent opportunities. |
90+
| Training committee convenes monthly. | Training committee meets twice a month. | ABC provides more rapid meetings initially for training development. |
91+
92+
---
93+
94+
### **12. Wages**
95+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
96+
|-----------------------------|--------------------------|--------------------|
97+
| Includes wage schedules attached as Appendix A (not provided explicitly). | Includes wage schedules attached as Appendix A (not provided explicitly). | No differences identified due to missing appendix content. |
98+
99+
---
100+
101+
### **13. Benefits**
102+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
103+
|-----------------------------|--------------------------|--------------------|
104+
| Comprehensive medical contribution allowance system with caps for premium increases (7.5%). | No specific benefit details provided. | Detailed and structured benefits framework in 123 Logistics compared to ABC's omission. |
105+
106+
---
107+
108+
### **14. Holidays**
109+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
110+
|-----------------------------|--------------------------|--------------------|
111+
| Lists standard national holidays with work and pay provisions. | No holiday provisions mentioned. | ABC Transit lacks holiday provisions. |
112+
113+
---
114+
115+
### **15. General Leave**
116+
| **123 Logistics Contract** | **ABC Transit Contract** | **Key Difference** |
117+
|-----------------------------|--------------------------|--------------------|
118+
| Includes detailed accrual rates based on years of service. | No general leave details mentioned. | ABC lacks structured leave accrual provisions. |
119+
120+
---
121+
122+
### **Summary**
123+
The 123 Logistics CBA provides stricter timelines, broader protections, and more structured processes across many sections. ABC Transit offers expanded access to shift bidding and shorter probationary requirements while omitting several detailed benefits and leave provisions present in 123 Logistics Contract. The differences highlight varying priorities, with ABC focused on flexibility and Logistics emphasizing procedural clarity and equity.

0 commit comments

Comments
 (0)