Spaces:
Sleeping
Sleeping
Update groq_api.py
Browse files- groq_api.py +13 -10
groq_api.py
CHANGED
|
@@ -5,20 +5,22 @@ import requests
|
|
| 5 |
|
| 6 |
GROQ_API_KEY = "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"
|
| 7 |
|
| 8 |
-
def summarize_match(
|
| 9 |
if not GROQ_API_KEY:
|
| 10 |
-
return "❌ GROQ_API_KEY not set
|
| 11 |
|
| 12 |
prompt = f"""
|
| 13 |
-
You are
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
{', '.join(
|
| 20 |
|
| 21 |
-
|
| 22 |
"""
|
| 23 |
|
| 24 |
try:
|
|
@@ -31,12 +33,13 @@ Please summarize which candidates seem most relevant and why.
|
|
| 31 |
json={
|
| 32 |
"model": "mixtral-8x7b-32768",
|
| 33 |
"messages": [{"role": "user", "content": prompt}],
|
| 34 |
-
"temperature": 0.5
|
| 35 |
},
|
| 36 |
timeout=30
|
| 37 |
)
|
|
|
|
| 38 |
response.raise_for_status()
|
| 39 |
return response.json()["choices"][0]["message"]["content"]
|
| 40 |
|
| 41 |
except Exception as e:
|
| 42 |
-
return f"❌ Groq API
|
|
|
|
| 5 |
|
| 6 |
GROQ_API_KEY = "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"
|
| 7 |
|
| 8 |
+
def summarize_match(job_description, cv_names):
|
| 9 |
if not GROQ_API_KEY:
|
| 10 |
+
return "❌ GROQ_API_KEY not set."
|
| 11 |
|
| 12 |
prompt = f"""
|
| 13 |
+
You are an AI recruiter assistant.
|
| 14 |
|
| 15 |
+
A company has the following job description:
|
| 16 |
+
---
|
| 17 |
+
{job_description}
|
| 18 |
+
---
|
| 19 |
|
| 20 |
+
Here are the names of the top matching CVs:
|
| 21 |
+
{', '.join(cv_names)}
|
| 22 |
|
| 23 |
+
Summarize why these candidates are a good fit for the job.
|
| 24 |
"""
|
| 25 |
|
| 26 |
try:
|
|
|
|
| 33 |
json={
|
| 34 |
"model": "mixtral-8x7b-32768",
|
| 35 |
"messages": [{"role": "user", "content": prompt}],
|
| 36 |
+
"temperature": 0.5
|
| 37 |
},
|
| 38 |
timeout=30
|
| 39 |
)
|
| 40 |
+
|
| 41 |
response.raise_for_status()
|
| 42 |
return response.json()["choices"][0]["message"]["content"]
|
| 43 |
|
| 44 |
except Exception as e:
|
| 45 |
+
return f"❌ Groq API error: {e}"
|