improved on sops generations on questions and added bot suggestion

This commit is contained in:
2024-09-16 23:38:33 +00:00
parent cd8f499f97
commit 47a274741f
10 changed files with 228 additions and 21 deletions
+35 -3
View File
@@ -107,6 +107,37 @@ class SopPersonalAssessment:
except:
return False
def generate_roles_from_questionnaire(self, questionnaire_data: List[dict]) -> Roles_response:
try:
# List of areas: ["communication", "development", etc.]
prompt = get_roles_extraction_from_questionnaire()
response = self.client.beta.chat.completions.parse(
model=self.model,
messages=[
{
"role": "system",
"content": f'''{prompt}''',
},
{
"role": "user",
"content": f'''Questionairre data : {questionnaire_data}''',
}
],
response_format=Roles_response,
max_tokens=1024,
temperature=0.1
)
extracted_text = json.loads(response.choices[0].message.content)
# You can customize this to generate roles based on the questionnaire data
return extracted_text
except Exception as e:
print(f"Error occurred: {str(e)}")
return False
@@ -116,7 +147,7 @@ class SopGeneratorExecutive:
self.client = OpenAI(api_key=self.api_key)
self.model = "gpt-4o-mini"
def extract_sops_from_executive_vision_goals_doc(self, data: dict,executives:List) -> SOPsResponse:
def extract_sops_from_executive_vision_goals_doc(self, data: dict,executive:str) -> SOPsResponse:
"""
Extracts SOPs categorized into 'must,' 'shall,' and 'will' based on executive vision and goals.
@@ -126,11 +157,12 @@ class SopGeneratorExecutive:
try:
vision = data.get("vision", "No vision provided")
goals = data.get("goals", "No goals provided")
goals = data.get("mission", "No goals provided")
prompt = get_sop_executive_from_vision_goals(executives)
prompt = get_sop_executive_from_vision_goals(executive)
user_content = f'''
Find the mission and vision provided below
Vision: {vision}
Goals: {goals}
'''