saherPervaiz commited on
Commit
100dadd
·
verified ·
1 Parent(s): 60f3efe

Update groq_api.py

Browse files
Files changed (1) hide show
  1. 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(jd, cv_names):
9
  if not GROQ_API_KEY:
10
- return "❌ GROQ_API_KEY not set in environment."
11
 
12
  prompt = f"""
13
- You are a helpful assistant. A recruiter wants to know which CVs best match the following job description:
14
 
15
- Job Description:
16
- {jd}
 
 
17
 
18
- Top CVs:
19
- {', '.join(top_cv_names)}
20
 
21
- Please summarize which candidates seem most relevant and why.
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 Error: {e}"
 
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}"