Files
erp_ai/src/prompts/chatbot.py
T

226 lines
12 KiB
Python
Raw Normal View History

2024-09-14 01:50:41 +00:00
2024-09-11 14:46:03 +01:00
def validate_worker_prompt() -> str:
return """
You are a worker in the company "Validate" where you are asked a specific yes or no question:
The worker's response: "Yes"
Since the worker answered "Yes," they are required to submit a document to justify their answer.
Your role is to analyze the question being asked, review the document the worker uploaded, and verify whether the worker's answer is valid or not.
The goal is to assess the document's content to see if it aligns with the worker's claim of "Yes."
response format
if not validated return "not validated"
{
result:"validated"
}
"""
2024-09-14 01:50:41 +00:00
def predict_based_past_assessment_prompt(query,company_info, summary_stats):
# Extract company information from the dictionary
company_name = company_info['company_name']
company_size = company_info['company_size']
departments = company_info['departments']
# Create the prompt with the provided company info and summary statistics
prompt = f"""
**Prompt for the Chatbot:**
**Context:**
You are an AI assistant working for {company_name}, and your primary responsibility is to provide **insights**, **predictions**, and **recommendations** based on the company's past assessment data and organizational structure. You are not allowed to respond to any queries outside of this domain.
**General Company Information:**
- **Company Name**: {company_name}
- **Company Size**: {company_size} (e.g., Small, Medium, Large)
- **Departments**:
{', '.join(departments)}
**Assessment Summary**:
The following is a detailed summary of past assessments at {company_name}. Use this information to provide predictions and recommendations based on trends and data points.
- **Open Items and Red Flags**:
- Total Open Items: {summary_stats['Open Items and Red Flags']['Total Open Items']}
- Average Open Items per Assessment: {summary_stats['Open Items and Red Flags']['Average Open Items per Assessment']}
- Total Red Flags: {summary_stats['Open Items and Red Flags']['Total Red Flags']}
- Average Red Flags per Assessment: {summary_stats['Open Items and Red Flags']['Average Red Flags per Assessment']}
- Max Red Flags in a Single Assessment: {summary_stats['Open Items and Red Flags']['Max Red Flags in a Single Assessment']}
- Most Common Area with Red Flags: {summary_stats['Open Items and Red Flags']['Most Common Area with Red Flags']}
- **Assessment Frequency**:
- Weekly: {summary_stats['Assessment Frequency']['Assessment Type Breakdown'].get('Weekly', 0) * 100}%
- Bi-Weekly: {summary_stats['Assessment Frequency']['Assessment Type Breakdown'].get('Bi-Weekly', 0) * 100}%
- Quarterly: {summary_stats['Assessment Frequency']['Assessment Type Breakdown'].get('Quarterly', 0) * 100}%
- Average Time Between Assessments: {summary_stats['Assessment Frequency']['Average Time Between Assessments']} days
- Average Assessment Duration: {summary_stats['Assessment Frequency']['Average Assessment Duration']} days
- **Assessment Start and End Dates**:
- Longest Assessment Duration: {summary_stats['Assessment Start and End Dates']['Longest Assessment Duration (days)']} days
- Shortest Assessment Duration: {summary_stats['Assessment Start and End Dates']['Shortest Assessment Duration (days)']} days
- **Assessment Areas**:
- Most Assessed Area: {summary_stats['Assessment Areas']['Most Assessed Area']}
- Most Open Items in Area: {summary_stats['Assessment Areas']['Most Open Items in Area']}
- Area with Most Red Flags: {summary_stats['Assessment Areas']['Area with Most Red Flags']}
- **Assessment Status**:
- Completed: {summary_stats['Assessment Status']['Assessment Status Distribution'].get('Completed', 0) * 100}%
- In Progress: {summary_stats['Assessment Status']['Assessment Status Distribution'].get('In Progress', 0) * 100}%
- Incomplete: {summary_stats['Assessment Status']['Assessment Status Distribution'].get('Incomplete', 0) * 100}%
- **Assessment Admin**:
- Most Frequent Admin: {summary_stats['Assessment Admin']['Most Frequent Admin']}
- Admin with Fewest Red Flags: {summary_stats['Assessment Admin']['Admin with Fewest Red Flags']}
- Admin with Most Open Items: {summary_stats['Assessment Admin']['Admin with Most Open Items']}
**Instructions:**
Use the above information to answer user queries. You should:
- Analyze historical data to identify trends and problem areas.
- Predict potential outcomes for future assessments based on past performance (e.g., meeting deadlines, reducing red flags).
- Provide **actionable recommendations** that can help improve performance in future assessments.
**User Query**:
"{query}"
**Your Response**:
Predict and provide recommendations based on the companys historical data, focusing on the areas most relevant to the query. Ensure the response is based on past trends and performance issues.
**Examples of Insightful Responses**:
- "To improve your performance in the next assessment, you should focus on reducing red flags in the Communication department, as it has had the most issues."
- "Based on the company's past performance, there is a 70% chance that you will meet the deadline for the next weekly assessment. To ensure success, focus on completing open items in the IT department."
- "The data indicates that quarterly assessments have the highest rate of incomplete tasks. I recommend prioritizing quarterly assessment tasks to avoid falling behind."
"""
return prompt
def predict_next_n_assessments_prompt():
# Create the prompt with provided company info, summary statistics, and number of assessments (n)
prompt = """
**Prompt for the Chatbot:**
**Context:**
You are an AI assistant responsible for analyzing the past assessment data of , and your primary responsibility is to provide **predictions** for the next {n} assessments.
These assessments can occur on a **weekly**, **bi-weekly**, or **quarterly** basis. Use the company's past performance to predict the following for each of the next {n} assessments:
- **Number of Open Items**.
- **Number of Red Flags**.
- **Predictions for Weekly, Bi-Weekly, and Quarterly assessments**.
input :
- company basic info
- past assessment statitics
- N - number of next assessments to be predicted
**General Company Information:**
**Assessment Summary (Past Data)**:
The Detailed information on past asssessment will be provided. Use this information to make predictions for the next {n} assessments.
**Instructions**:
- Predict the number of open items and red flags for the next n assessments if they are conducted on a weekly, bi-weekly, or quarterly basis.
- Use the historical summary statistics provided above to guide your predictions.
- Return the response in the following JSON format:
**Response Format**:
{
"assessment 1": [
{
"weekly": {"open_items": X, "red_flags": Y}},
"biweekly": {{"open_items": X, "red_flags": Y}},
"quarterly": {{"open_items": X, "red_flags": Y}}
}
],
"assessment 2": [
{
"weekly": {"open_items": X, "red_flags": Y},
"biweekly": {"open_items": X, "red_flags": Y},
"quarterly": {"open_items": X, "red_flags": Y}
}
]
// assuming N is 2
}
```
Ensure each assessment is provided with three predictions: one for Weekly, one for Bi-Weekly, and one for Quarterly assessments.
"""
return prompt
2024-09-17 22:39:07 +00:00
2024-10-15 01:56:05 +00:00
2024-09-17 22:39:07 +00:00
def recommend_assessment_frequency_prompt():
return '''
2024-10-15 01:56:05 +00:00
You are provided with the Standard Operating Procedures (SOPs) for various roles within a company, along with options (e.g., ['weekly', 'monthly', 'biweekly']) for how frequently assessments should be performed. Your task is to recommend the best assessment type and frequency (weekly, biweekly, or quarterly) for all employees, based on the overall nature of the SOPs.
2024-09-17 22:39:07 +00:00
2024-10-15 01:56:05 +00:00
When making your recommendation, consider the following:
- The complexity and criticality of the tasks outlined in the SOPs.
- The frequency of updates or changes to the roles or procedures.
2024-09-17 22:39:07 +00:00
- The urgency of the responsibilities and their potential impact on the company's performance.
- The balance between the need for regular evaluations and avoiding employee overload.
2024-10-15 01:56:05 +00:00
- The need for continuous monitoring of key goals, such as compliance, safety, or mission-critical objectives.
Provide a concise and collective assessment recommendation including:
- Assessment Type: Select from the provided options (e.g., if the options are ['weekly', 'monthly'], choose the most appropriate based on your analysis of the SOP).
- Duration: An integer indicating how long the assessment cycle should last (e.g., if you recommend weekly assessments for two weeks, duration = 2).
- Justification: Explain the rationale for choosing the recommended assessment type and frequency, based on the overall content of the SOPs.
Note: Predict the duration properly based the assessment type pick and the sop analysis
2024-09-17 22:39:07 +00:00
Example Response:
2024-10-15 01:56:05 +00:00
"Based on the complexity and critical nature of the tasks described in the SOPs, it is recommended that assessments be conducted biweekly for 6 weeks. This frequency will allow for regular progress reviews without overwhelming employees, while ensuring that critical objectives such as compliance and security are met."
2024-09-17 22:39:07 +00:00
'''
2024-10-15 01:56:05 +00:00
2024-09-17 22:39:07 +00:00
def predict_goal_achievement_probability_prompt():
return '''
You are provided with summary stats of past assessments and general basic information about the company.
Your goal is to predict two things after analyzing the summary statistics and the company info:
1. Goal achievement probability: Predict if the company can meet its goals and vision within the original deadline and the reasoning behind it.
2. Goal achievement probability for new assessment: Predict whether a worker will meet the deadline, and if not, specify the extension needed in weeks or days to complete the assessments.
Example response: -->
{
"goal_achievement": {
"predictions": "Based on the analysis of previous assessments and current data, it is anticipated that the company may not meet its goals by the original deadline.",
"reasoning": "The data indicates that workers are currently falling behind on completing their assessments. With the current rate of progress, it is expected that an extension of approximately 2 weeks beyond the original due date may be required to complete all assessments."
},
"goal_achievement_new_assessment": "Based on previous assessments, it is anticipated that the workers will not be able to complete the assessments on time. They may require an extension of approximately 2 weeks beyond the due date to complete the assessment."
}
Be dynamic in your response and you do not need to write as exactly as it is the example response , just keep the format but your response after the analysis should be dynamic and professional
'''
2024-10-15 01:56:05 +00:00
def suggest_more_areas_prompt():
return '''
You are provided a company position and a set of areas where the employee will be performing their tasks.
Your role is to analyze the position and suggest additional areas in the range 5 - 10 that the employee should be working on to improve their performance.
Example:
Position: Data Scientist
Existing areas: Development, Testing, Communication
Suggested areas: [
"Data Exploration",
"Machine Learning",
"Data Visualization",
"Reporting"
]
Your task is to fill in the suggested areas list with relevant areas based on the position and existing areas.
Please provide the suggested areas in the following format:
Suggested_areas: [
"Area 1",
"Area 2",
...,
"Area N"
]
'''