mirror of
https://github.com/SkalaraAI/management-llm.git
synced 2025-04-09 15:00:19 -04:00
initialized flask server for backend task match.
This commit is contained in:
parent
75fcf820b5
commit
26ebdc64c3
|
@ -14,7 +14,7 @@ def index():
|
||||||
response = openai.Completion.create(model="text-davinci-003",
|
response = openai.Completion.create(model="text-davinci-003",
|
||||||
prompt = generate_prompt(task_form),
|
prompt = generate_prompt(task_form),
|
||||||
temperature=0,
|
temperature=0,
|
||||||
max_tokens=100)
|
max_tokens=2048)
|
||||||
return redirect(url_for("index", result=response.choices[0].text))
|
return redirect(url_for("index", result=response.choices[0].text))
|
||||||
|
|
||||||
result = request.args.get("result")
|
result = request.args.get("result")
|
||||||
|
|
9
flask_testing/testing_api.py
Normal file
9
flask_testing/testing_api.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import os
|
||||||
|
import openai
|
||||||
|
|
||||||
|
# Load your API key from an environment variable or secret management service
|
||||||
|
openai.api_key = os.getenv("OPENAI_API_KEY")
|
||||||
|
|
||||||
|
response = openai.Completion.create(model="text-davinci-003", prompt="You are a software manager at the company Alphabet. Q: Format a message that specifically delegates the parts of the following task to your team of engineers. TASK: develop a new Machine Learning-based recommendation system for YouTube. A: ", temperature=0, max_tokens=100)
|
||||||
|
|
||||||
|
print(response.choices[0].text.strip())
|
42105
task-server/UpdatedResumeDataset2.csv
Normal file
42105
task-server/UpdatedResumeDataset2.csv
Normal file
File diff suppressed because one or more lines are too long
78
task-server/app.py
Normal file
78
task-server/app.py
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
from flask import Flask, request, jsonify
|
||||||
|
import pandas as pd
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import os
|
||||||
|
import openai
|
||||||
|
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
openai.api_key = os.getenv("OPENAI_API_KEY")
|
||||||
|
|
||||||
|
# Sample data to store tasks and users
|
||||||
|
tasks_data = {}
|
||||||
|
users_data = {}
|
||||||
|
|
||||||
|
def generate_prompt(task_form):
|
||||||
|
base_text = "You are a software engineer at a software development company. Your job is to assign tags to tasks based on the software/tools used. Please generate one-word tags representing software/tools/libraries commonly used by developers to build or complete the following task."
|
||||||
|
return base_text + "TASK: " + task_form
|
||||||
|
|
||||||
|
def generate_technical_tags(task_form):
|
||||||
|
prompt = generate_prompt(task_form)
|
||||||
|
|
||||||
|
response = openai.Completion.create(
|
||||||
|
model="text-davinci-003",
|
||||||
|
prompt=prompt,
|
||||||
|
temperature=0,
|
||||||
|
max_tokens=100,
|
||||||
|
stop=["TASK:"]
|
||||||
|
)
|
||||||
|
|
||||||
|
tags = response.choices[0].text.strip().split("\n")
|
||||||
|
return tags
|
||||||
|
|
||||||
|
@app.route('/label_tasks', methods=['POST'])
|
||||||
|
def get_task_tags():
|
||||||
|
# try:
|
||||||
|
data = request.get_json()
|
||||||
|
tasks = data[0]['tasks']
|
||||||
|
result = {}
|
||||||
|
for task, task_description in tasks.items():
|
||||||
|
task_id = task_description["id"]
|
||||||
|
task_content = task_description["content"]
|
||||||
|
task_complexity = task_description["complexityScore"]
|
||||||
|
|
||||||
|
tags = generate_technical_tags(task_content) # where the function that gets the tags is placed
|
||||||
|
result[task_id] = tags
|
||||||
|
return jsonify(result)
|
||||||
|
# except Exception as e:
|
||||||
|
# return jsonify({"error": str(e)}), 500
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/assign_tasks', methods=['POST'])
|
||||||
|
def assign_tasks_to_users():
|
||||||
|
try:
|
||||||
|
data = request.get_json()
|
||||||
|
tasks = data[0]['tasks']
|
||||||
|
users = data[0]['users']
|
||||||
|
result = {}
|
||||||
|
|
||||||
|
tasks_dict = {}
|
||||||
|
users_dict = {}
|
||||||
|
|
||||||
|
for task, task_description in tasks.items():
|
||||||
|
tasks_dict[task_description["id"]] = {"tags" : task_description["content"], "complexity" : task_description["complexityScore"]}
|
||||||
|
# tasks_dict[task_description["id"]] = {"tags" : generate_technical_tags(task_description["content"]), "complexity" : task_description["complexityScore"]}
|
||||||
|
|
||||||
|
for user, user_description in users.items():
|
||||||
|
users_dict[user_description["id"]] = {"strengths" : user_description["strengths"], "current_tasks" : user_description["currentTasks"]}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# return jsonify(result)
|
||||||
|
return result
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({"error": str(e)}), 500
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(debug=True)
|
81
task-server/tasks.json
Normal file
81
task-server/tasks.json
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"tasks" : {
|
||||||
|
"1" : {
|
||||||
|
"id": "1",
|
||||||
|
"content": "Implement a login page with form validation using React.js.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"2" : {
|
||||||
|
"id": "2",
|
||||||
|
"content": "Set up a RESTful API using Node.js and Express.js.",
|
||||||
|
"complexityScore": 4
|
||||||
|
},
|
||||||
|
"3" : {
|
||||||
|
"id": "3",
|
||||||
|
"content": "Design a user-friendly dashboard layout with interactive charts and graphs.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"4" : {
|
||||||
|
"id": "4",
|
||||||
|
"content": "Implement authentication and authorization using JWT and bcrypt.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"5" : {
|
||||||
|
"id": "5",
|
||||||
|
"content": "Create a database schema for storing employee data and performance metrics.",
|
||||||
|
"complexityScore": 4
|
||||||
|
},
|
||||||
|
"6" : {
|
||||||
|
"id": "6",
|
||||||
|
"content": "Design a responsive user interface with a modern and clean aesthetic.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"7" : {
|
||||||
|
"id": "7",
|
||||||
|
"content": "Implement data visualization using a charting library like D3.js.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"8" : {
|
||||||
|
"id": "8",
|
||||||
|
"content": "Set up a MongoDB database for storing and querying analytics data.",
|
||||||
|
"complexityScore": 4
|
||||||
|
},
|
||||||
|
"9" : {
|
||||||
|
"id": "9",
|
||||||
|
"content": "Create wireframes for the employee profile page displaying key performance indicators.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"10" : {
|
||||||
|
"id": "10",
|
||||||
|
"content": "Implement CRUD operations for managing employee data using REST APIs.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"11" : {
|
||||||
|
"id": "11",
|
||||||
|
"content": "Design a visually appealing landing page with clear call-to-action buttons.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"12" : {
|
||||||
|
"id": "12",
|
||||||
|
"content": "Implement user authentication using Firebase Authentication.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"13" : {
|
||||||
|
"id": "13",
|
||||||
|
"content": "Set up a Next.js project with server-side rendering for improved performance.",
|
||||||
|
"complexityScore": 4
|
||||||
|
},
|
||||||
|
"14" : {
|
||||||
|
"id": "14",
|
||||||
|
"content": "Design a mobile-friendly layout for seamless viewing on different devices.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"15" : {
|
||||||
|
"id": "15",
|
||||||
|
"content": "Implement a search functionality for easily finding employee records.",
|
||||||
|
"complexityScore": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
24
task-server/unit_testing.py
Normal file
24
task-server/unit_testing.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import json
|
||||||
|
import requests
|
||||||
|
|
||||||
|
def test_get_task_tags():
|
||||||
|
with open('./tasks.json', 'r') as file:
|
||||||
|
data = json.load(file)
|
||||||
|
response = requests.post('http://127.0.0.1:5000/label_tasks', json=data)
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
result = response.json()
|
||||||
|
print(json.dumps(result, indent=2))
|
||||||
|
else:
|
||||||
|
print(f"Error: {response.status_code}, {response.text}")
|
||||||
|
|
||||||
|
def test_assign_tasks_to_users():
|
||||||
|
with open('users_tasks.json', 'r') as file:
|
||||||
|
data = json.load(file)
|
||||||
|
|
||||||
|
response = requests.post('http://127.0.0.1:5000/assign_tasks', json=data)
|
||||||
|
print(response.json())
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# test_get_task_tags()
|
||||||
|
test_assign_tasks_to_users()
|
159
task-server/users_tasks.json
Normal file
159
task-server/users_tasks.json
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"tasks" : {
|
||||||
|
"1" : {
|
||||||
|
"id": "1",
|
||||||
|
"content": "Implement a login page with form validation using React.js.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"2" : {
|
||||||
|
"id": "2",
|
||||||
|
"content": "Set up a RESTful API using Node.js and Express.js.",
|
||||||
|
"complexityScore": 4
|
||||||
|
},
|
||||||
|
"3" : {
|
||||||
|
"id": "3",
|
||||||
|
"content": "Design a user-friendly dashboard layout with interactive charts and graphs.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"4" : {
|
||||||
|
"id": "4",
|
||||||
|
"content": "Implement authentication and authorization using JWT and bcrypt.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"5" : {
|
||||||
|
"id": "5",
|
||||||
|
"content": "Create a database schema for storing employee data and performance metrics.",
|
||||||
|
"complexityScore": 4
|
||||||
|
},
|
||||||
|
"6" : {
|
||||||
|
"id": "6",
|
||||||
|
"content": "Design a responsive user interface with a modern and clean aesthetic.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"7" : {
|
||||||
|
"id": "7",
|
||||||
|
"content": "Implement data visualization using a charting library like D3.js.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"8" : {
|
||||||
|
"id": "8",
|
||||||
|
"content": "Set up a MongoDB database for storing and querying analytics data.",
|
||||||
|
"complexityScore": 4
|
||||||
|
},
|
||||||
|
"9" : {
|
||||||
|
"id": "9",
|
||||||
|
"content": "Create wireframes for the employee profile page displaying key performance indicators.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"10" : {
|
||||||
|
"id": "10",
|
||||||
|
"content": "Implement CRUD operations for managing employee data using REST APIs.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"11" : {
|
||||||
|
"id": "11",
|
||||||
|
"content": "Design a visually appealing landing page with clear call-to-action buttons.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"12" : {
|
||||||
|
"id": "12",
|
||||||
|
"content": "Implement user authentication using Firebase Authentication.",
|
||||||
|
"complexityScore": 3
|
||||||
|
},
|
||||||
|
"13" : {
|
||||||
|
"id": "13",
|
||||||
|
"content": "Set up a Next.js project with server-side rendering for improved performance.",
|
||||||
|
"complexityScore": 4
|
||||||
|
},
|
||||||
|
"14" : {
|
||||||
|
"id": "14",
|
||||||
|
"content": "Design a mobile-friendly layout for seamless viewing on different devices.",
|
||||||
|
"complexityScore": 2
|
||||||
|
},
|
||||||
|
"15" : {
|
||||||
|
"id": "15",
|
||||||
|
"content": "Implement a search functionality for easily finding employee records.",
|
||||||
|
"complexityScore": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"users" : {
|
||||||
|
"1" : {
|
||||||
|
"id": "1",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"2" : {
|
||||||
|
"id": "2",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"3" : {
|
||||||
|
"id": "3",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"4" : {
|
||||||
|
"id": "4",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"5" : {
|
||||||
|
"id": "5",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"6" : {
|
||||||
|
"id": "6",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"7" : {
|
||||||
|
"id": "7",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"8" : {
|
||||||
|
"id": "8",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"9" : {
|
||||||
|
"id": "9",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"10" : {
|
||||||
|
"id": "10",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"11" : {
|
||||||
|
"id": "11",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"12" : {
|
||||||
|
"id": "12",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"13" : {
|
||||||
|
"id": "13",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"14" : {
|
||||||
|
"id": "14",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
},
|
||||||
|
"15" : {
|
||||||
|
"id": "15",
|
||||||
|
"currentTasks": 0,
|
||||||
|
"strengths" : []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
35
user-system/user.py
Normal file
35
user-system/user.py
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
class User:
|
||||||
|
def __init__(self, name, employee_title):
|
||||||
|
self.name = name
|
||||||
|
self.employee_title = employee_title
|
||||||
|
self.top_skills = []
|
||||||
|
self.tasks_completed = {}
|
||||||
|
self.task_types = {}
|
||||||
|
self.task_efficiency = {}
|
||||||
|
|
||||||
|
def add_skill(self, skill):
|
||||||
|
self.top_skills.append(skill)
|
||||||
|
|
||||||
|
def add_completed_task(self, task_name, task_type, efficiency):
|
||||||
|
self.tasks_completed[task_name] = efficiency
|
||||||
|
self.task_types[task_name] = task_type
|
||||||
|
self.task_efficiency[task_name] = efficiency
|
||||||
|
|
||||||
|
def get_task_efficiency(self, task_name):
|
||||||
|
return self.task_efficiency.get(task_name, None)
|
||||||
|
|
||||||
|
|
||||||
|
# Example usage:
|
||||||
|
user = User("John Doe", "Software Developer")
|
||||||
|
user.add_skill("Python")
|
||||||
|
user.add_skill("JavaScript")
|
||||||
|
user.add_completed_task("Project A", "Development", 0.8)
|
||||||
|
user.add_completed_task("Project B", "Testing", 0.9)
|
||||||
|
|
||||||
|
print(user.name) # Output: John Doe
|
||||||
|
print(user.employee_title) # Output: Software Developer
|
||||||
|
print(user.top_skills) # Output: ['Python', 'JavaScript']
|
||||||
|
print(user.tasks_completed) # Output: {'Project A': 0.8, 'Project B': 0.9}
|
||||||
|
print(user.task_types) # Output: {'Project A': 'Development', 'Project B': 'Testing'}
|
||||||
|
print(user.get_task_efficiency("Project A")) # Output: 0.8
|
||||||
|
print(user.get_task_efficiency("Project C")) # Output: None
|
Loading…
Reference in New Issue
Block a user