Edited final_answer
Browse files
tools/.ipynb_checkpoints/final_answer-checkpoint.py
CHANGED
@@ -32,11 +32,11 @@ class FinalAnswerTool(Tool):
|
|
32 |
|
33 |
# Case 2: If the answer is a list of job listings, format them properly
|
34 |
elif isinstance(answer, list) and all(isinstance(job, dict) for job in answer):
|
35 |
-
formatted_output = "**🔍 Job Listings Found**\n\n"
|
36 |
-
|
37 |
if not answer:
|
38 |
return "⚠️ No job listings found."
|
39 |
|
|
|
|
|
40 |
for idx, job in enumerate(answer, start=1):
|
41 |
title = job.get("Title", "Unknown Job Title")
|
42 |
company = job.get("Company", "Unknown Company")
|
@@ -47,7 +47,7 @@ class FinalAnswerTool(Tool):
|
|
47 |
f" - **Company:** {company}\n"
|
48 |
f" - **Location:** {location}\n\n"
|
49 |
)
|
50 |
-
return formatted_output
|
51 |
|
52 |
# Case 3: If it's an unexpected format, return it as a formatted string
|
53 |
else:
|
|
|
32 |
|
33 |
# Case 2: If the answer is a list of job listings, format them properly
|
34 |
elif isinstance(answer, list) and all(isinstance(job, dict) for job in answer):
|
|
|
|
|
35 |
if not answer:
|
36 |
return "⚠️ No job listings found."
|
37 |
|
38 |
+
formatted_output = "**🔍 Job Listings Found**\n\n"
|
39 |
+
|
40 |
for idx, job in enumerate(answer, start=1):
|
41 |
title = job.get("Title", "Unknown Job Title")
|
42 |
company = job.get("Company", "Unknown Company")
|
|
|
47 |
f" - **Company:** {company}\n"
|
48 |
f" - **Location:** {location}\n\n"
|
49 |
)
|
50 |
+
return formatted_output.strip()
|
51 |
|
52 |
# Case 3: If it's an unexpected format, return it as a formatted string
|
53 |
else:
|
tools/final_answer.py
CHANGED
@@ -32,11 +32,11 @@ class FinalAnswerTool(Tool):
|
|
32 |
|
33 |
# Case 2: If the answer is a list of job listings, format them properly
|
34 |
elif isinstance(answer, list) and all(isinstance(job, dict) for job in answer):
|
35 |
-
formatted_output = "**🔍 Job Listings Found**\n\n"
|
36 |
-
|
37 |
if not answer:
|
38 |
return "⚠️ No job listings found."
|
39 |
|
|
|
|
|
40 |
for idx, job in enumerate(answer, start=1):
|
41 |
title = job.get("Title", "Unknown Job Title")
|
42 |
company = job.get("Company", "Unknown Company")
|
@@ -47,7 +47,7 @@ class FinalAnswerTool(Tool):
|
|
47 |
f" - **Company:** {company}\n"
|
48 |
f" - **Location:** {location}\n\n"
|
49 |
)
|
50 |
-
return formatted_output
|
51 |
|
52 |
# Case 3: If it's an unexpected format, return it as a formatted string
|
53 |
else:
|
|
|
32 |
|
33 |
# Case 2: If the answer is a list of job listings, format them properly
|
34 |
elif isinstance(answer, list) and all(isinstance(job, dict) for job in answer):
|
|
|
|
|
35 |
if not answer:
|
36 |
return "⚠️ No job listings found."
|
37 |
|
38 |
+
formatted_output = "**🔍 Job Listings Found**\n\n"
|
39 |
+
|
40 |
for idx, job in enumerate(answer, start=1):
|
41 |
title = job.get("Title", "Unknown Job Title")
|
42 |
company = job.get("Company", "Unknown Company")
|
|
|
47 |
f" - **Company:** {company}\n"
|
48 |
f" - **Location:** {location}\n\n"
|
49 |
)
|
50 |
+
return formatted_output.strip()
|
51 |
|
52 |
# Case 3: If it's an unexpected format, return it as a formatted string
|
53 |
else:
|