diff --git a/README.md b/README.md
index 4191b268d..aacc8354c 100644
--- a/README.md
+++ b/README.md
@@ -114,8 +114,8 @@ In this scenario, a financial advisor is preparing for a meeting with a potentia
Now that the financial advisor is more informed about Woodgrove’s Emerging Markets Funds, they're better equipped to respond to questions about this fund from their client.
-#### Contract Review and Summarization Assistant scenario
-Additionally, we have implemented a Contract Review and Summarization Assistant scenario to demonstrate how this accelerator can be utilized in any industry. The Contract Review and Summarization Assistant helps professionals manage and interact with a large collection of documents efficiently. For more details, refer to the [Contract Review and Summarization Assistant README](docs/contract_assistance.md).
+#### Legal Review and Summarization Assistant scenario
+Additionally, we have implemented a Legal Review and Summarization Assistant scenario to demonstrate how this accelerator can be utilized in any industry. The Legal Review and Summarization Assistant helps professionals manage and interact with a large collection of documents efficiently. For more details, refer to the [Legal Review and Summarization Assistant README](docs/contract_assistance.md).
Note: Some of the sample data included with this accelerator was generated using AI and is for illustrative purposes only.
diff --git a/code/backend/batch/utilities/helpers/config/assistant_strategy.py b/code/backend/batch/utilities/helpers/config/assistant_strategy.py
index a84b88a8a..41ca2a2d5 100644
--- a/code/backend/batch/utilities/helpers/config/assistant_strategy.py
+++ b/code/backend/batch/utilities/helpers/config/assistant_strategy.py
@@ -3,4 +3,4 @@
class AssistantStrategy(Enum):
DEFAULT = "default"
- LEGAL_ASSISTANT = "legal assistant"
+ CONTRACT_ASSISTANT = "contract assistant"
diff --git a/code/backend/batch/utilities/helpers/config/config_helper.py b/code/backend/batch/utilities/helpers/config/config_helper.py
index 7ad35bbe2..677bdf5d4 100644
--- a/code/backend/batch/utilities/helpers/config/config_helper.py
+++ b/code/backend/batch/utilities/helpers/config/config_helper.py
@@ -246,13 +246,13 @@ def get_default_config():
@staticmethod
@functools.cache
- def get_default_legal_assistant():
- legal_file_path = os.path.join(os.path.dirname(__file__), "default_legal_assistant_prompt.txt")
- legal_assistant = ""
- with open(legal_file_path, encoding="utf-8") as f:
- legal_assistant = f.readlines()
+ def get_default_contract_assistant():
+ contract_file_path = os.path.join(os.path.dirname(__file__), "default_contract_assistant_prompt.txt")
+ contract_assistant = ""
+ with open(contract_file_path, encoding="utf-8") as f:
+ contract_assistant = f.readlines()
- return ''.join([str(elem) for elem in legal_assistant])
+ return ''.join([str(elem) for elem in contract_assistant])
@staticmethod
def clear_config():
diff --git a/code/backend/batch/utilities/helpers/config/default_legal_assistant_prompt.txt b/code/backend/batch/utilities/helpers/config/default_contract_assistant_prompt.txt
similarity index 98%
rename from code/backend/batch/utilities/helpers/config/default_legal_assistant_prompt.txt
rename to code/backend/batch/utilities/helpers/config/default_contract_assistant_prompt.txt
index 12477c69c..cd2d2121e 100644
--- a/code/backend/batch/utilities/helpers/config/default_legal_assistant_prompt.txt
+++ b/code/backend/batch/utilities/helpers/config/default_contract_assistant_prompt.txt
@@ -60,7 +60,7 @@
- If the information is not available in the context, reply that the information is not in the knowledge base.
## Very Important Instruction
-- YOU ARE AN AI LEGAL ASSISTANT.
+- YOU ARE AN AI CONTRACT ASSISTANT.
- If you can't answer a question using available documents, reply politely that the information is not in the knowledge base.
- Questions with a date range, use documents within the same range.
Question: {question}
diff --git a/code/backend/pages/04_Configuration.py b/code/backend/pages/04_Configuration.py
index 74af882c9..c5f682953 100644
--- a/code/backend/pages/04_Configuration.py
+++ b/code/backend/pages/04_Configuration.py
@@ -93,12 +93,10 @@ def validate_answering_user_prompt():
st.warning("Your answering prompt doesn't contain the variable `{question}`")
-def config_legal_assistant_prompt():
- if st.session_state["ai_assistant_type"] == AssistantStrategy.LEGAL_ASSISTANT.value:
- st.success("Legal Assistant Prompt")
- st.session_state["answering_user_prompt"] = (
- ConfigHelper.get_default_legal_assistant()
- )
+def config_contract_assistant_prompt():
+ if st.session_state["ai_assistant_type"] == AssistantStrategy.CONTRACT_ASSISTANT.value:
+ st.success("Contract Assistant Prompt")
+ st.session_state["answering_user_prompt"] = ConfigHelper.get_default_contract_assistant()
else:
st.success("Default Assistant Prompt")
st.session_state["answering_user_prompt"] = (
@@ -190,7 +188,7 @@ def validate_documents():
post_answering_prompt_help = "You can configure a post prompt that allows to fact-check or process the answer, given the sources, question and answer. This prompt needs to return `True` or `False`."
use_on_your_data_format_help = "Whether to use a similar prompt format to Azure OpenAI On Your Data, including separate system and user messages, and a few-shot example."
post_answering_filter_help = "The message that is returned to the user, when the post-answering prompt returns."
- ai_assistant_type_help = "Whether to use the default user prompt or the Legal Assistance user prompt. Refer to the Legal Assistance README for more details."
+ ai_assistant_type_help = "Whether to use the default user prompt or the Contract Assistance user prompt. Refer to the Contract Assistance README for more details."
example_documents_help = (
"JSON object containing documents retrieved from the knowledge base, in the following format: \n"
"""```json
@@ -219,7 +217,7 @@ def validate_documents():
st.selectbox(
"Assistant Type",
key="ai_assistant_type",
- on_change=config_legal_assistant_prompt,
+ on_change=config_contract_assistant_prompt,
options=config.get_available_ai_assistant_types(),
help=ai_assistant_type_help,
)
diff --git a/code/create_app.py b/code/create_app.py
index 58651783e..c8eba08b4 100644
--- a/code/create_app.py
+++ b/code/create_app.py
@@ -448,4 +448,10 @@ def speech_config():
return {"error": "Failed to get speech config"}, 500
+ @app.route("/api/assistanttype", methods=["GET"])
+ def assistanttype():
+ ConfigHelper.get_active_config_or_default.cache_clear()
+ result = ConfigHelper.get_active_config_or_default()
+ return jsonify({"ai_assistant_type": result.prompts.ai_assistant_type})
+
return app
diff --git a/code/frontend/src/api/api.ts b/code/frontend/src/api/api.ts
index 3e5209432..8bd8a66fd 100644
--- a/code/frontend/src/api/api.ts
+++ b/code/frontend/src/api/api.ts
@@ -21,3 +21,24 @@ export async function callConversationApi(options: ConversationRequest, abortSig
return response;
}
+
+export async function getAssistantTypeApi() {
+ try {
+ const response = await fetch("/api/assistanttype", {
+ method: "GET",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ });
+
+ if (!response.ok) {
+ throw new Error('Network response was not ok');
+ }
+
+ const config = await response.json(); // Parse JSON response
+ return config;
+ } catch (error) {
+ console.error('Failed to fetch configuration:', error);
+ return null; // Return null or some default value in case of error
+ }
+ }
diff --git a/code/frontend/src/assets/Interact with data.svg b/code/frontend/src/assets/Interact with data.svg
new file mode 100644
index 000000000..fc1da9d7b
--- /dev/null
+++ b/code/frontend/src/assets/Interact with data.svg
@@ -0,0 +1,3 @@
+
diff --git a/code/frontend/src/assets/Quick source reference.svg b/code/frontend/src/assets/Quick source reference.svg
new file mode 100644
index 000000000..442a7752c
--- /dev/null
+++ b/code/frontend/src/assets/Quick source reference.svg
@@ -0,0 +1,4 @@
+
diff --git a/code/frontend/src/assets/Summarize contracts.svg b/code/frontend/src/assets/Summarize contracts.svg
new file mode 100644
index 000000000..01e53feb6
--- /dev/null
+++ b/code/frontend/src/assets/Summarize contracts.svg
@@ -0,0 +1,3 @@
+
diff --git a/code/frontend/src/pages/chat/Cards_contract/Cards.module.css b/code/frontend/src/pages/chat/Cards_contract/Cards.module.css
new file mode 100644
index 000000000..7c69ecf8e
--- /dev/null
+++ b/code/frontend/src/pages/chat/Cards_contract/Cards.module.css
@@ -0,0 +1,57 @@
+
+/* Homepage.module.css */
+.container {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 16px;
+ /* background-color: #FAF9F8; */
+}
+
+.mainContent {
+ width: 100%;
+ display: flex;
+ justify-content: center;
+}
+
+.cards {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 16px; /* Adjust gap between cards as needed */
+ justify-content: center; /* Center align cards in the row */
+}
+
+.featureCard {
+ width: 260px; /* Set a fixed width for the cards or adjust as needed */
+ display: inline;
+ flex-direction: column;
+ justify-content: space-between;
+ text-align: start;
+ background-color: #FAF9F8;
+ border-radius: 8px; /* Rounded corners */
+ border: 1px solid #EDEBE9; /* Border around the card */
+ box-shadow: 0px 4px 8px 0px #00000024;
+ padding: 18px; /* Add padding inside the card */
+}
+
+
+.cardTitle {
+ font-size: 16px; /* Adjust font size as needed */
+ margin-top: -30px;
+ margin-left: 30px;
+ font-weight: 600;
+ color: #3d3d3d;
+
+}
+.iconTitleContainer{
+ display: flex;
+ align-items: center;
+}
+.cardDescription {
+ font-size: 14px; /* Adjust font size as needed */
+ color: #3d3d3d;
+ margin-bottom: -2px;
+}
+.icon{
+ margin-top: 10px;
+}
diff --git a/code/frontend/src/pages/chat/Cards_contract/Cards.tsx b/code/frontend/src/pages/chat/Cards_contract/Cards.tsx
new file mode 100644
index 000000000..6b058429f
--- /dev/null
+++ b/code/frontend/src/pages/chat/Cards_contract/Cards.tsx
@@ -0,0 +1,54 @@
+// src/pages/FeaturePage.tsx
+import React from 'react';
+import { Stack } from '@fluentui/react';
+import IntractData from '../../../assets/Interact with data.svg'
+import SourceReference from '../../../assets/Quick source reference.svg'
+import SummarizeContracts from '../../../assets/Summarize contracts.svg'
+import styles from './Cards.module.css'; // Create this CSS module for custom styles
+
+const Cards: React.FC = () => {
+ return (
+
This chatbot is configured to answer your questions
+ >
+ ) :
+
+
Loading...
+
}
+
+
) : (
{
);
+
};
export default Chat;
diff --git a/code/tests/utilities/helpers/test_config_helper.py b/code/tests/utilities/helpers/test_config_helper.py
index 8ddd6bb03..0c2c990dd 100644
--- a/code/tests/utilities/helpers/test_config_helper.py
+++ b/code/tests/utilities/helpers/test_config_helper.py
@@ -349,13 +349,13 @@ def test_get_default_assistant_prompt():
assert isinstance(default_assistant_prompt, str)
-def test_get_default_legal_assistant():
+def test_get_default_contract_assistant():
# when
- legal_assistant_prompt = ConfigHelper.get_default_legal_assistant()
+ contract_assistant_prompt = ConfigHelper.get_default_contract_assistant()
# then
- assert legal_assistant_prompt is not None
- assert isinstance(legal_assistant_prompt, str)
+ assert contract_assistant_prompt is not None
+ assert isinstance(contract_assistant_prompt, str)
def test_get_document_processors(config_dict: dict):
diff --git a/data/legal_data/1628215729_Kyndryl_-_Master_Agreement__executed_utah.pdf b/data/contract_data/1628215729_Kyndryl_-_Master_Agreement__executed_utah.pdf
similarity index 100%
rename from data/legal_data/1628215729_Kyndryl_-_Master_Agreement__executed_utah.pdf
rename to data/contract_data/1628215729_Kyndryl_-_Master_Agreement__executed_utah.pdf
diff --git a/data/legal_data/Final_MA_999_200000000170_3_MA_FORM_ADV_PDF wireless.PDF b/data/contract_data/Final_MA_999_200000000170_3_MA_FORM_ADV_PDF wireless.PDF
similarity index 100%
rename from data/legal_data/Final_MA_999_200000000170_3_MA_FORM_ADV_PDF wireless.PDF
rename to data/contract_data/Final_MA_999_200000000170_3_MA_FORM_ADV_PDF wireless.PDF
diff --git a/data/legal_data/Final_MA_999_200000000325_3_MA_FORM_ADV_PDF.PDF b/data/contract_data/Final_MA_999_200000000325_3_MA_FORM_ADV_PDF.PDF
similarity index 100%
rename from data/legal_data/Final_MA_999_200000000325_3_MA_FORM_ADV_PDF.PDF
rename to data/contract_data/Final_MA_999_200000000325_3_MA_FORM_ADV_PDF.PDF
diff --git a/data/legal_data/Initial_MA_2023_V1 - servers.pdf b/data/contract_data/Initial_MA_2023_V1 - servers.pdf
similarity index 100%
rename from data/legal_data/Initial_MA_2023_V1 - servers.pdf
rename to data/contract_data/Initial_MA_2023_V1 - servers.pdf
diff --git a/data/legal_data/Legal contract_20240411112609.pdf b/data/contract_data/Legal contract_20240411112609.pdf
similarity index 100%
rename from data/legal_data/Legal contract_20240411112609.pdf
rename to data/contract_data/Legal contract_20240411112609.pdf
diff --git a/data/legal_data/Master_Agreement_OEM_Filters_ALDOT_V1 - OEM filters.pdf b/data/contract_data/Master_Agreement_OEM_Filters_ALDOT_V1 - OEM filters.pdf
similarity index 100%
rename from data/legal_data/Master_Agreement_OEM_Filters_ALDOT_V1 - OEM filters.pdf
rename to data/contract_data/Master_Agreement_OEM_Filters_ALDOT_V1 - OEM filters.pdf
diff --git a/data/legal_data/Master_Agreement_OEM_Filters_V1.pdf b/data/contract_data/Master_Agreement_OEM_Filters_V1.pdf
similarity index 100%
rename from data/legal_data/Master_Agreement_OEM_Filters_V1.pdf
rename to data/contract_data/Master_Agreement_OEM_Filters_V1.pdf
diff --git a/data/legal_data/Master_Agreement_Renewed_V2 - copiers.pdf b/data/contract_data/Master_Agreement_Renewed_V2 - copiers.pdf
similarity index 100%
rename from data/legal_data/Master_Agreement_Renewed_V2 - copiers.pdf
rename to data/contract_data/Master_Agreement_Renewed_V2 - copiers.pdf
diff --git a/data/legal_data/Master_Agreement_V1 (1).pdf b/data/contract_data/Master_Agreement_V1 (1).pdf
similarity index 100%
rename from data/legal_data/Master_Agreement_V1 (1).pdf
rename to data/contract_data/Master_Agreement_V1 (1).pdf
diff --git a/data/legal_data/Master_Agreement_V1 - July.pdf b/data/contract_data/Master_Agreement_V1 - July.pdf
similarity index 100%
rename from data/legal_data/Master_Agreement_V1 - July.pdf
rename to data/contract_data/Master_Agreement_V1 - July.pdf
diff --git a/data/legal_data/Master_Agreement_V1 - May.pdf b/data/contract_data/Master_Agreement_V1 - May.pdf
similarity index 100%
rename from data/legal_data/Master_Agreement_V1 - May.pdf
rename to data/contract_data/Master_Agreement_V1 - May.pdf
diff --git a/data/legal_data/Master_Agreement_V1 - propane.pdf b/data/contract_data/Master_Agreement_V1 - propane.pdf
similarity index 100%
rename from data/legal_data/Master_Agreement_V1 - propane.pdf
rename to data/contract_data/Master_Agreement_V1 - propane.pdf
diff --git a/data/legal_data/Master_agreement_2024_V1 products_services.pdf b/data/contract_data/Master_agreement_2024_V1 products_services.pdf
similarity index 100%
rename from data/legal_data/Master_agreement_2024_V1 products_services.pdf
rename to data/contract_data/Master_agreement_2024_V1 products_services.pdf
diff --git a/data/legal_data/NASPO_Participating_Addendum - insight public sector.pdf b/data/contract_data/NASPO_Participating_Addendum - insight public sector.pdf
similarity index 100%
rename from data/legal_data/NASPO_Participating_Addendum - insight public sector.pdf
rename to data/contract_data/NASPO_Participating_Addendum - insight public sector.pdf
diff --git a/data/legal_data/NASPO_VP_SVAR_Insight_AL_PA.pdf b/data/contract_data/NASPO_VP_SVAR_Insight_AL_PA.pdf
similarity index 100%
rename from data/legal_data/NASPO_VP_SVAR_Insight_AL_PA.pdf
rename to data/contract_data/NASPO_VP_SVAR_Insight_AL_PA.pdf
diff --git a/data/legal_data/Server_Storage_Solutions_Technical_Services_ITB_v1.2 - OEM Terms.pdf b/data/contract_data/Server_Storage_Solutions_Technical_Services_ITB_v1.2 - OEM Terms.pdf
similarity index 100%
rename from data/legal_data/Server_Storage_Solutions_Technical_Services_ITB_v1.2 - OEM Terms.pdf
rename to data/contract_data/Server_Storage_Solutions_Technical_Services_ITB_v1.2 - OEM Terms.pdf
diff --git a/data/legal_data/State_of_Alabama_NASPO_Cloud_Services_PA_032224_.docx 1.pdf b/data/contract_data/State_of_Alabama_NASPO_Cloud_Services_PA_032224_.docx 1.pdf
similarity index 100%
rename from data/legal_data/State_of_Alabama_NASPO_Cloud_Services_PA_032224_.docx 1.pdf
rename to data/contract_data/State_of_Alabama_NASPO_Cloud_Services_PA_032224_.docx 1.pdf
diff --git a/data/legal_data/State_of_Alabama_NASPO_Cloud_Services_PA_032224_.docx.pdf b/data/contract_data/State_of_Alabama_NASPO_Cloud_Services_PA_032224_.docx.pdf
similarity index 100%
rename from data/legal_data/State_of_Alabama_NASPO_Cloud_Services_PA_032224_.docx.pdf
rename to data/contract_data/State_of_Alabama_NASPO_Cloud_Services_PA_032224_.docx.pdf
diff --git a/data/legal_data/Statewide_Truck_Chassis_19_000_GVWR_and_Greater-Southland_V1.pdf b/data/contract_data/Statewide_Truck_Chassis_19_000_GVWR_and_Greater-Southland_V1.pdf
similarity index 100%
rename from data/legal_data/Statewide_Truck_Chassis_19_000_GVWR_and_Greater-Southland_V1.pdf
rename to data/contract_data/Statewide_Truck_Chassis_19_000_GVWR_and_Greater-Southland_V1.pdf
diff --git a/docs/contract_assistance.md b/docs/contract_assistance.md
index a3e3c316c..ce980a164 100644
--- a/docs/contract_assistance.md
+++ b/docs/contract_assistance.md
@@ -9,9 +9,9 @@ The following is the Chat With Your Data infrastructure configuration that we su
- **Azure Semantic Search**: Utilize Azure Semantic Search to efficiently index and search legal documents. This provides powerful search capabilities and integration with other Azure services.
- **Azure Cognitive Search Top K 15**: Set the Top K parameter to 15 to retrieve the top 15 most relevant documents. This configuration helps in providing precise and relevant search results for user queries.
-- **Azure Search Integrated Vectorization**: Enable integrated vectorization in Azure Search to improve the semantic understanding and relevance of search results. This enhances the Legal Assistant's ability to provide contextually accurate answers.
+- **Azure Search Integrated Vectorization**: Enable integrated vectorization in Azure Search to improve the semantic understanding and relevance of search results. This enhances the Contract Assistant's ability to provide contextually accurate answers.
- **Azure OpenAI Model gpt-4o**: Leverage the Azure OpenAI model gpt-4o for advanced natural language processing capabilities. This model is well-suited for handling complex legal queries and providing detailed and contextually appropriate responses.
-- **Orchestration Strategy: Semantic Kernel**: Implement the Semantic Kernel orchestration strategy to effectively manage the integration and interaction between different components of the infrastructure. This strategy ensures seamless operation and optimal performance of the Legal Assistant.
+- **Orchestration Strategy: Semantic Kernel**: Implement the Semantic Kernel orchestration strategy to effectively manage the integration and interaction between different components of the infrastructure. This strategy ensures seamless operation and optimal performance of the Contract Assistant.
- **Conversation Flow Options**: Setting `CONVERSATION_FLOW` enables running advanced AI models like GPT-4o on your own enterprise data without needing to train or fine-tune models.
By following these infrastructure configurations, you can enhance the efficiency, accuracy, and overall performance of the Chat With Your Data Contract Review and Summarization Assistant, ensuring it meets the high demands and expectations of professionals.
@@ -30,17 +30,17 @@ To apply the suggested configurations in your deployment, update the following f
## Admin Configuration
-In the admin panel, there is a dropdown to select the Chat With Your Data Legal Assistant. The options are:
+In the admin panel, there is a dropdown to select the Chat With Your Data Contract Assistant. The options are:
- **Default**: Chat With Your Data default prompt.
-![UnSelected](images/cwyd_admin_legal_unselected.png)
+![UnSelected](images/cwyd_admin_contract_unselected.png)
- **Selected**: Contract Review and Summarization Assistant prompt.
-![Checked](images/cwyd_admin_legal_selected.png)
+![Checked](images/cwyd_admin_contract_selected.png)
-When the user selects "Legal Assistant," the user prompt textbox will update to the Legal Assistant prompt. When the user selects the default, the user prompt textbox will update to the default prompt. Note that if the user has a custom prompt in the user prompt textbox, selecting an option from the dropdown will overwrite the custom prompt with the default or legal assistant prompt. Ensure to **Save the Configuration** after making this change.
+When the user selects "Contract Assistant," the user prompt textbox will update to the Contract Assistant prompt. When the user selects the default, the user prompt textbox will update to the default prompt. Note that if the user has a custom prompt in the user prompt textbox, selecting an option from the dropdown will overwrite the custom prompt with the default or contract assistant prompt. Ensure to **Save the Configuration** after making this change.
## Contract Review and Summarization Assistant Prompt
The Contract Review and Summarization Assistant prompt configuration ensures that the AI responds accurately based on the given context, handling a variety of tasks such as listing documents, filtering based on specific criteria, and summarizing document content. Below is the detailed prompt configuration:
@@ -49,12 +49,12 @@ The Contract Review and Summarization Assistant prompt configuration ensures tha
## Summary Contracts
Context:
{sources}
-- You are a legal assistant.
+- You are a contract assistant.
```
-You can see the [Contract Review and Summarization Assistant Prompt](../code/backend/batch/utilities/helpers/config/default_legal_assistant_prompt.txt) file for more details.
+You can see the [Contract Review and Summarization Assistant Prompt](../code/backend/batch/utilities/helpers/config/default_contract_assistant_prompt.txt) file for more details.
-## Sample Legal Data
-We have added sample contract data in the [Legal Assistant sample Docs](../data/legal_data) folder. This data can be used to test and demonstrate the Contract Review and Summarization Assistant's capabilities.
+## Sample Contract Data
+We have added sample contract data in the [Contract Assistant sample Docs](../data/contract_data) folder. This data can be used to test and demonstrate the Contract Review and Summarization Assistant's capabilities.
## Conclusion
This README provides an overview of the Chat With Your Data Contract Review and Summarization Assistant prompt, instructions for updating the prompt configuration, and examples of questions and answers. Ensure you follow the guidelines for updating the prompt to maintain consistency and accuracy in responses.
diff --git a/docs/images/cwyd_admin_legal_selected.png b/docs/images/cwyd_admin_contract_selected.png
similarity index 100%
rename from docs/images/cwyd_admin_legal_selected.png
rename to docs/images/cwyd_admin_contract_selected.png