Shareflex Contract RAG AI Chatbot powered by Azure Vector Search

Introduction and Goal

The goal is to build a 100% Azure-based AI chatbot (ChatGPT-like) that can intelligently and quickly answer end-user questions about contract data stored in the Shareflex Contract solution.

A simple full-text search is not smart enough for this use case. The chosen approach stores contract documents and metadata in a vector-based search index, allowing the chat agent to search based on meaning and context instead of only exact keywords.

RAG

This solution uses a RAG (Retrieval Augmented Generation) architecture, where the chatbot first retrieves the most relevant information from a vector-based search index and then generates an answer based on the retrieved content.

Vector search

Vector search allows AI to search based on meaning and context instead of only exact keywords. This makes it possible to find relevant contract information even when users use different wording, spelling mistakes, abbreviations, or natural language questions.

End-to-End Architecture

The result

Highlight contracts that could be harmful to the company and explain the risks?

Based on the retrieved contracts, the following agreements contain clauses that could pose potential risks or be harmful to Lialis B.V.: 1.**Advocaten verkoop unit 12 (Legal Services Agreement with an Attorney's Office) 1 ** ◦Risk of High Penalties: The contract imposes a very high penalty of EUR 250,000 per breach of confidentiality, which could be financially damaging if confidentiality is accidentally breached.
◦Strict Payment and Termination Terms: Early termination by Lialis without permission results in payment of all remaining contract value plus a 35% penalty, which is a significant financial risk if the company needs to cancel early.
◦Severe Late Payment Penalties: EUR 500 per day penalty for late payments beyond 7 days is steep and could accumulate rapidly.
◦Unlimited Liability: The contractor has full liability for any damage without limitation, potentially exposing Lialis to high costs if issues arise.

2.**Support bij bedrijfshack (Emergency Cybersecurity Support Contract) 2 ** ◦Very High Penalties for Delays: The contract includes escalating penalties up to EUR 250,000 plus damage compensation if the supplier fails to respond within 2 hours, which could be financially burdensome.
◦Strict Non-Disclosure Agreement (NDA): Breaches of confidentiality by either party carry a EUR 500,000 penalty plus full damage compensation, exposing Lialis to huge financial risk if confidentiality is compromised.
◦Minimum Hour Requirement: Minimum of 8 hours per incident at EUR 450/hour could lead to high costs for minor incidents.
◦No Limitation of Liability: Supplier is fully liable without limits, which could lead to significant legal exposure.

3.**Contract for SharePoint Support Services with TechPro Solutions N.V. 3 ** ◦Termination Risks: The client (potentially Lialis if it were party) can terminate immediately if SLA breaches occur more than 10 times a year, which may disrupt service continuity.
◦Limited Liability of Supplier: The supplier’s liability is limited to the total annual fees paid, which may limit recourse in case of major failures but also could leave Lialis exposed if relying on the service.
◦Penalties for SLA Breaches: While penalties are moderate compared to above contracts, repeated breaches may still result in financial losses or termination of contract.

4.**Non-Disclosure Agreement with GlobalSoft Solutions GmbH 4 ** ◦Duration of Confidentiality Obligations: The NDA confidentiality obligations last 3 years, which is standard but could be a risk if sensitive information is leaked during this period.
◦No License Granted: This is standard but limits use of information strictly to the agreed purpose, so misuse could lead to legal issues.

Summary:
The **Legal Services Agreement 1 ** and **Cybersecurity Incident Support Contract 2 ** present the highest financial and operational risks due to steep penalties for breaches, strict termination conditions, and unlimited liability clauses. The **SharePoint Support Contract 3 ** also carries risks related to service continuity and limited supplier liability. The NDA is standard but confidentiality breaches could still be harmful.
Lialis should carefully manage compliance, payment, and confidentiality requirements in these contracts to mitigate potential harm.
If you want, I can help extract specific clauses or suggest risk mitigation strategies.  

How it has been made

The solution was built entirely on Microsoft Azure using a combination of SharePoint, Power Automate, Azure OpenAI, and Azure AI Search. Contract documents stored in the Shareflex Contract solution are automatically processed on a scheduled basis.

The Power Automate flow retrieves contract PDF documents and related Shareflex metadata directly from SharePoint. AI Builder OCR is then used to extract readable text from the documents. Based on this extracted content, Azure OpenAI generates AI summaries and vector embeddings.

These vector embeddings are stored in Azure AI Search together with the contract metadata, OCR content, and AI-generated summaries. This creates a semantic vector-based search index that allows the chatbot to search based on meaning and context instead of exact keywords only.

On top of the Azure AI Search index, a conversational AI agent was configured using Azure AI Foundry and Azure OpenAI. The chatbot retrieves the most relevant contract information from the vector search index and generates contextual answers for the end user. The solution also supports conversational follow-up questions, allowing users to continue interacting naturally with the contract data.

The result is a fully Azure-native RAG (Retrieval Augmented Generation) architecture that combines semantic vector search with ChatGPT-like conversational capabilities for Shareflex Contract Management data.