Rename working_app.py to app.py
Browse files- working_app.py → app.py +2 -22
working_app.py → app.py
RENAMED
|
@@ -34,7 +34,7 @@ def analyze_attrition_with_llm(df_dict, hr_query):
|
|
| 34 |
employees_data = {row["Employee"].strip(): row["Sentiment"] for _, row in df.iterrows()}
|
| 35 |
|
| 36 |
prompt = f"HR Query: {hr_query}\nEmployees Data: {json.dumps(employees_data, indent=2)}"
|
| 37 |
-
|
| 38 |
model="gpt-4o-mini",
|
| 39 |
messages=[{"role": "user", "content": prompt}],
|
| 40 |
functions=[
|
|
@@ -54,27 +54,7 @@ def analyze_attrition_with_llm(df_dict, hr_query):
|
|
| 54 |
],
|
| 55 |
function_call="auto"
|
| 56 |
)
|
| 57 |
-
|
| 58 |
-
response = client.chat.completions.create(
|
| 59 |
-
model="gpt-4o-mini",
|
| 60 |
-
messages=[{"role": "user", "content": prompt}],
|
| 61 |
-
functions=[
|
| 62 |
-
{
|
| 63 |
-
"name": "predict_attrition_risk",
|
| 64 |
-
"description": "Predicts attrition risk based on sentiment and provides explanation.",
|
| 65 |
-
"parameters": {
|
| 66 |
-
"type": "object",
|
| 67 |
-
"properties": {
|
| 68 |
-
"employee_name": {"type": "string", "description": "Employee's name"},
|
| 69 |
-
"sentiment": {"type": "string", "description": "Extracted sentiment"},
|
| 70 |
-
"explanation": {"type": "string", "description": "Brief explanation"}
|
| 71 |
-
},
|
| 72 |
-
"required": ["employee_name", "sentiment", "explanation"]
|
| 73 |
-
}
|
| 74 |
-
}
|
| 75 |
-
],
|
| 76 |
-
function_call="auto"
|
| 77 |
-
)
|
| 78 |
print(response) # Debugging: Print response
|
| 79 |
|
| 80 |
# Handle function call response properly
|
|
|
|
| 34 |
employees_data = {row["Employee"].strip(): row["Sentiment"] for _, row in df.iterrows()}
|
| 35 |
|
| 36 |
prompt = f"HR Query: {hr_query}\nEmployees Data: {json.dumps(employees_data, indent=2)}"
|
| 37 |
+
response = client.chat.completions.create(
|
| 38 |
model="gpt-4o-mini",
|
| 39 |
messages=[{"role": "user", "content": prompt}],
|
| 40 |
functions=[
|
|
|
|
| 54 |
],
|
| 55 |
function_call="auto"
|
| 56 |
)
|
| 57 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
print(response) # Debugging: Print response
|
| 59 |
|
| 60 |
# Handle function call response properly
|