gperdrizet commited on
Commit
7ff29b0
·
verified ·
1 Parent(s): b09a239

Fixed job call summarization

Browse files
Files changed (3) hide show
  1. configuration.py +0 -6
  2. functions/gradio.py +4 -0
  3. functions/job_call.py +16 -3
configuration.py CHANGED
@@ -78,10 +78,4 @@ Format your output as a JSON with the following sections:
78
  'Tools/technologies': 'List of any tools or technologies mentioned in the job post',
79
  'Experience level': 'Description of the experience level required for the job (e.g., entry-level, mid-level, senior)',
80
  'Education requirements': 'Description of the education requirements for the job (e.g., degree, certifications)',
81
-
82
-
83
- Here is the the job call to extract the information:
84
-
85
- JOB CALL
86
-
87
  """
 
78
  'Tools/technologies': 'List of any tools or technologies mentioned in the job post',
79
  'Experience level': 'Description of the experience level required for the job (e.g., entry-level, mid-level, senior)',
80
  'Education requirements': 'Description of the education requirements for the job (e.g., degree, certifications)',
 
 
 
 
 
 
81
  """
functions/gradio.py CHANGED
@@ -145,14 +145,17 @@ def process_inputs(linkedin_pdf, github_url, job_post_text, user_instructions):
145
  result += "✅ Job post text provided\n"
146
  logger.info("Job post text provided (%d characters)", len(job_post_text))
147
  job_text_to_use = job_post_text.strip()
 
148
  else:
149
  result += "ℹ️ No job post provided, attempting to use default\n"
150
  logger.info("No job post text provided, trying default")
151
 
152
  # Try to load default job call
153
  default_job = load_default_job_call()
 
154
  if default_job:
155
  job_text_to_use = default_job
 
156
  else:
157
  result += "ℹ️ No default job post available, proceeding without job post\n"
158
  logger.info("No default job post available, proceeding without job analysis")
@@ -160,6 +163,7 @@ def process_inputs(linkedin_pdf, github_url, job_post_text, user_instructions):
160
 
161
  # Generate job summary (will use default if job_text_to_use is None)
162
  summary = None
 
163
  if job_text_to_use:
164
  summary = summarize_job_call(job_text_to_use)
165
 
 
145
  result += "✅ Job post text provided\n"
146
  logger.info("Job post text provided (%d characters)", len(job_post_text))
147
  job_text_to_use = job_post_text.strip()
148
+
149
  else:
150
  result += "ℹ️ No job post provided, attempting to use default\n"
151
  logger.info("No job post text provided, trying default")
152
 
153
  # Try to load default job call
154
  default_job = load_default_job_call()
155
+
156
  if default_job:
157
  job_text_to_use = default_job
158
+
159
  else:
160
  result += "ℹ️ No default job post available, proceeding without job post\n"
161
  logger.info("No default job post available, proceeding without job analysis")
 
163
 
164
  # Generate job summary (will use default if job_text_to_use is None)
165
  summary = None
166
+
167
  if job_text_to_use:
168
  summary = summarize_job_call(job_text_to_use)
169
 
functions/job_call.py CHANGED
@@ -35,9 +35,14 @@ def load_default_job_call() -> str:
35
  with open(default_job_path, 'r', encoding='utf-8') as f:
36
  job_text = f.read().strip()
37
 
38
- logger.info("Loaded default job call from: %s (%d characters)",
39
- default_job_path, len(job_text))
 
 
 
 
40
  return job_text
 
41
  else:
42
  logger.info("No default job call file found at: %s", default_job_path)
43
  return ""
@@ -59,6 +64,7 @@ def summarize_job_call(job_call: str) -> str:
59
 
60
  if not job_call or not job_call.strip():
61
  logger.warning("No job call text provided for summarization")
 
62
  return None
63
 
64
  logger.info("Summarizing job call (%d characters)", len(job_call))
@@ -72,6 +78,10 @@ def summarize_job_call(job_call: str) -> str:
72
  {
73
  'role': 'system',
74
  'content': f'{JOB_CALL_EXTRACTION_PROMPT}{job_call}'
 
 
 
 
75
  }
76
  ]
77
 
@@ -80,12 +90,14 @@ def summarize_job_call(job_call: str) -> str:
80
  'messages': messages,
81
  }
82
 
 
 
83
  try:
84
  response = client.chat.completions.create(**completion_args)
85
 
86
  except Exception as e:
87
  response = None
88
- logger.error('Error during Modal API call: %s', e)
89
 
90
  if response is not None:
91
  summary = response.choices[0].message.content
@@ -93,6 +105,7 @@ def summarize_job_call(job_call: str) -> str:
93
  # Save the extracted job call information to data directory
94
  try:
95
  _save_job_call_data(job_call, summary)
 
96
  except Exception as save_error:
97
  logger.warning("Failed to save job call data: %s", str(save_error))
98
 
 
35
  with open(default_job_path, 'r', encoding='utf-8') as f:
36
  job_text = f.read().strip()
37
 
38
+ logger.info(
39
+ "Loaded default job call from: %s (%d characters)",
40
+ default_job_path,
41
+ len(job_text)
42
+ )
43
+
44
  return job_text
45
+
46
  else:
47
  logger.info("No default job call file found at: %s", default_job_path)
48
  return ""
 
64
 
65
  if not job_call or not job_call.strip():
66
  logger.warning("No job call text provided for summarization")
67
+
68
  return None
69
 
70
  logger.info("Summarizing job call (%d characters)", len(job_call))
 
78
  {
79
  'role': 'system',
80
  'content': f'{JOB_CALL_EXTRACTION_PROMPT}{job_call}'
81
+ },
82
+ {
83
+ 'role': 'user',
84
+ 'content': f'JOB CALL\n{job_call}'
85
  }
86
  ]
87
 
 
90
  'messages': messages,
91
  }
92
 
93
+ print(completion_args)
94
+
95
  try:
96
  response = client.chat.completions.create(**completion_args)
97
 
98
  except Exception as e:
99
  response = None
100
+ logger.error('Error during job summarization API call: %s', e)
101
 
102
  if response is not None:
103
  summary = response.choices[0].message.content
 
105
  # Save the extracted job call information to data directory
106
  try:
107
  _save_job_call_data(job_call, summary)
108
+
109
  except Exception as save_error:
110
  logger.warning("Failed to save job call data: %s", str(save_error))
111