added worker validation bot
This commit is contained in:
@@ -1,72 +1,16 @@
|
||||
import json
|
||||
from src.services.questions_generator import QuestionsGenerator
|
||||
# Example usage of the Chatbot class:
|
||||
from src.services.chatbot import Chatbot
|
||||
from src.utils.document_loader import load_document
|
||||
if __name__ == "__main__":
|
||||
chatbot = Chatbot()
|
||||
|
||||
# Mocking the SOPs input as described in your example
|
||||
mock_sops_input = {
|
||||
"sops": {
|
||||
"departments": [
|
||||
{
|
||||
"name": "Accounts Receivable",
|
||||
"workers": [
|
||||
{
|
||||
"name": "Angela Lewis",
|
||||
"position": "AR Director",
|
||||
"sops": {
|
||||
"must": [],
|
||||
"shall": [],
|
||||
"will": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Jamie Vega",
|
||||
"position": "AR Supervisor",
|
||||
"sops": {
|
||||
"must": [
|
||||
"Provide escalation information to the AR Director if additional escalations are needed."
|
||||
],
|
||||
"shall": [],
|
||||
"will": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Jessica Merzougui",
|
||||
"position": "AR Supervisor",
|
||||
"sops": {
|
||||
"must": [
|
||||
"Provide escalation information to the AR Director if additional escalations are needed."
|
||||
],
|
||||
"shall": [],
|
||||
"will": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Deniece Santos",
|
||||
"position": "AR Analyst",
|
||||
"sops": {
|
||||
"must": [],
|
||||
"shall": [],
|
||||
"will": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
# Example inputs
|
||||
path = r"C:\Users\User\Desktop\Blessing_AI\MKD\test_erp_ai\erp_ai\test\erp_ai\data\raw\coding_task_completion_document.pdf"
|
||||
|
||||
# Defining the full input data including additional parameters
|
||||
input_data = {
|
||||
"sops": json.dumps(mock_sops_input), # Convert SOPs to JSON string format
|
||||
"assessment_type": "progress", # Set the assessment type
|
||||
"frequency_type": "weekly", # Set the frequency type (daily, weekly, etc.)
|
||||
"duration": 4 # Set the duration (number of frequency cycles, e.g., 4 weeks)
|
||||
}
|
||||
question = "Have you completed Task X?"
|
||||
user_input = "Yes"
|
||||
docs = load_document(path)
|
||||
|
||||
# Initialize the QuestionsGenerator
|
||||
generator = QuestionsGenerator()
|
||||
|
||||
# Invoke the generate_questions method with the mock input
|
||||
questions_response = generator.generate_questions(input_data)
|
||||
|
||||
# Print the generated questions response
|
||||
print(json.dumps(questions_response, indent=4))
|
||||
# Validate the worker's answer using the provided document
|
||||
validation_result = chatbot.validate_worker(question, docs)
|
||||
print(validation_result)
|
||||
Reference in New Issue
Block a user