Spaces:
Sleeping
Sleeping
Commit ·
9ae7818
1
Parent(s): dbde425
added error handling
Browse files- routers/query/query.py +17 -7
routers/query/query.py
CHANGED
|
@@ -54,23 +54,33 @@ def _query(data: RequestType):
|
|
| 54 |
list_ = data.urls
|
| 55 |
|
| 56 |
object_ = ScrapeJobDetails(list_)
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
lr = GenerateLLMResponse(llm)
|
| 60 |
|
| 61 |
resultList = {}
|
| 62 |
|
| 63 |
for url in list_:
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
custom_prompt = lr._buildPrompt(
|
| 70 |
context = context, cover_letter=data.cover_letter, jobData=response_dict[url], task=data.task)
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
resultList[url] = final_response
|
| 76 |
|
|
|
|
| 54 |
list_ = data.urls
|
| 55 |
|
| 56 |
object_ = ScrapeJobDetails(list_)
|
| 57 |
+
|
| 58 |
+
try:
|
| 59 |
+
response_dict = object_._run()
|
| 60 |
+
except Exception as e:
|
| 61 |
+
return {"Scraping Failed": e }
|
| 62 |
+
|
| 63 |
lr = GenerateLLMResponse(llm)
|
| 64 |
|
| 65 |
resultList = {}
|
| 66 |
|
| 67 |
for url in list_:
|
| 68 |
|
| 69 |
+
try:
|
| 70 |
+
context = lr._extract_relevant_details(
|
| 71 |
+
resume=data.resume, job_desc=response_dict[url]
|
| 72 |
+
)
|
| 73 |
+
except Exception as e:
|
| 74 |
+
return {"Extracting Resume Details Failed": e }
|
| 75 |
|
| 76 |
custom_prompt = lr._buildPrompt(
|
| 77 |
context = context, cover_letter=data.cover_letter, jobData=response_dict[url], task=data.task)
|
| 78 |
|
| 79 |
+
try:
|
| 80 |
+
final_response = lr._runInferenceLoop(
|
| 81 |
+
instruction=instructions, prompt=custom_prompt)
|
| 82 |
+
except Exception as e:
|
| 83 |
+
return {"Generating final Results Failed": e }
|
| 84 |
|
| 85 |
resultList[url] = final_response
|
| 86 |
|