Update app.py
Browse files
app.py
CHANGED
|
@@ -34,11 +34,9 @@ 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 |
-
response = client.responses.create(
|
| 39 |
model="gpt-4o-mini",
|
| 40 |
-
|
| 41 |
-
input=[{"role": "user", "content": prompt}],
|
| 42 |
functions=[
|
| 43 |
{
|
| 44 |
"name": "predict_attrition_risk",
|
|
@@ -57,7 +55,7 @@ def analyze_attrition_with_llm(df_dict, hr_query):
|
|
| 57 |
function_call="auto"
|
| 58 |
)
|
| 59 |
|
| 60 |
-
print(response
|
| 61 |
|
| 62 |
# Handle function call response properly
|
| 63 |
if response.choices[0].message.function_call:
|
|
|
|
| 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=[
|
| 41 |
{
|
| 42 |
"name": "predict_attrition_risk",
|
|
|
|
| 55 |
function_call="auto"
|
| 56 |
)
|
| 57 |
|
| 58 |
+
print(response) # Debugging: Print response
|
| 59 |
|
| 60 |
# Handle function call response properly
|
| 61 |
if response.choices[0].message.function_call:
|