[FIX] fixes code for download temp files related part.
Browse files- tools/final_answer.py +3 -0
- tools/linkedin_job_search.py +2 -1
- tools/odoo_code_agent_16.py +5 -3
- tools/odoo_code_agent_17.py +5 -3
- tools/odoo_code_agent_18.py +5 -6
tools/final_answer.py
CHANGED
@@ -39,6 +39,9 @@ class FinalAnswerTool(Tool):
|
|
39 |
# Check if the answer contains file paths
|
40 |
file_paths = re.findall(r"("+re.escape(cwd)+r"/[^\s'\"]+)", answer)
|
41 |
|
|
|
|
|
|
|
42 |
if file_paths:
|
43 |
try:
|
44 |
# Create a temporary directory
|
|
|
39 |
# Check if the answer contains file paths
|
40 |
file_paths = re.findall(r"("+re.escape(cwd)+r"/[^\s'\"]+)", answer)
|
41 |
|
42 |
+
if not file_paths and isinstance(answer, list) and all(isinstance(item, str) for item in answer):
|
43 |
+
file_paths = answer
|
44 |
+
|
45 |
if file_paths:
|
46 |
try:
|
47 |
# Create a temporary directory
|
tools/linkedin_job_search.py
CHANGED
@@ -12,8 +12,9 @@ def scrape_indeed(position: str, location: str) -> List[Dict]:
|
|
12 |
Scrapes job postings from Indeed.
|
13 |
"""
|
14 |
url = f"https://www.indeed.com/jobs?q=Odoo+{position}&l={location}"
|
|
|
15 |
try:
|
16 |
-
response = requests.get(url)
|
17 |
response.raise_for_status()
|
18 |
soup = BeautifulSoup(response.content, 'html.parser')
|
19 |
jobs = []
|
|
|
12 |
Scrapes job postings from Indeed.
|
13 |
"""
|
14 |
url = f"https://www.indeed.com/jobs?q=Odoo+{position}&l={location}"
|
15 |
+
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'}
|
16 |
try:
|
17 |
+
response = requests.get(url, headers=headers)
|
18 |
response.raise_for_status()
|
19 |
soup = BeautifulSoup(response.content, 'html.parser')
|
20 |
jobs = []
|
tools/odoo_code_agent_16.py
CHANGED
@@ -3,7 +3,7 @@ import requests
|
|
3 |
from typing import List, Dict
|
4 |
from bs4 import BeautifulSoup
|
5 |
from transformers import pipeline # Requires transformers
|
6 |
-
|
7 |
|
8 |
class OdooCodeAgent16(Tool):
|
9 |
name = "odoo_code_agent_16"
|
@@ -66,5 +66,7 @@ class OdooCodeAgent16(Tool):
|
|
66 |
# This could involve using the Qwen/Qwen2.5-Coder-32B-Instruct model to generate code
|
67 |
# based on the search results and the user's query.
|
68 |
|
69 |
-
#
|
70 |
-
|
|
|
|
|
|
3 |
from typing import List, Dict
|
4 |
from bs4 import BeautifulSoup
|
5 |
from transformers import pipeline # Requires transformers
|
6 |
+
import tempfile
|
7 |
|
8 |
class OdooCodeAgent16(Tool):
|
9 |
name = "odoo_code_agent_16"
|
|
|
66 |
# This could involve using the Qwen/Qwen2.5-Coder-32B-Instruct model to generate code
|
67 |
# based on the search results and the user's query.
|
68 |
|
69 |
+
# Create a temporary file and return its path
|
70 |
+
with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as tmpfile:
|
71 |
+
tmpfile.write(b"placeholder_code = 'Odoo code will be generated here'")
|
72 |
+
return tmpfile.name
|
tools/odoo_code_agent_17.py
CHANGED
@@ -3,7 +3,7 @@ import requests
|
|
3 |
from typing import List, Dict
|
4 |
from bs4 import BeautifulSoup
|
5 |
from transformers import pipeline # Requires transformers
|
6 |
-
|
7 |
|
8 |
class OdooCodeAgent17(Tool):
|
9 |
name = "odoo_code_agent_17"
|
@@ -66,5 +66,7 @@ class OdooCodeAgent17(Tool):
|
|
66 |
# This could involve using the Qwen/Qwen2.5-Coder-32B-Instruct model to generate code
|
67 |
# based on the search results and the user's query.
|
68 |
|
69 |
-
#
|
70 |
-
|
|
|
|
|
|
3 |
from typing import List, Dict
|
4 |
from bs4 import BeautifulSoup
|
5 |
from transformers import pipeline # Requires transformers
|
6 |
+
import tempfile
|
7 |
|
8 |
class OdooCodeAgent17(Tool):
|
9 |
name = "odoo_code_agent_17"
|
|
|
66 |
# This could involve using the Qwen/Qwen2.5-Coder-32B-Instruct model to generate code
|
67 |
# based on the search results and the user's query.
|
68 |
|
69 |
+
# Create a temporary file and return its path
|
70 |
+
with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as tmpfile:
|
71 |
+
tmpfile.write(b"placeholder_code = 'Odoo code will be generated here'")
|
72 |
+
return tmpfile.name
|
tools/odoo_code_agent_18.py
CHANGED
@@ -3,6 +3,7 @@ import requests
|
|
3 |
from typing import List, Dict
|
4 |
from bs4 import BeautifulSoup
|
5 |
from transformers import pipeline # Requires transformers
|
|
|
6 |
|
7 |
class OdooCodeAgent18(Tool):
|
8 |
name = "odoo_code_agent_18"
|
@@ -65,9 +66,7 @@ class OdooCodeAgent18(Tool):
|
|
65 |
# This could involve using the Qwen/Qwen2.5-Coder-32B-Instruct model to generate code
|
66 |
# based on the search results and the user's query.
|
67 |
|
68 |
-
#
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
# For now, just return a placeholder message
|
73 |
-
return "Placeholder Odoo 18 code generated based on the query and documentation."
|
|
|
3 |
from typing import List, Dict
|
4 |
from bs4 import BeautifulSoup
|
5 |
from transformers import pipeline # Requires transformers
|
6 |
+
import tempfile
|
7 |
|
8 |
class OdooCodeAgent18(Tool):
|
9 |
name = "odoo_code_agent_18"
|
|
|
66 |
# This could involve using the Qwen/Qwen2.5-Coder-32B-Instruct model to generate code
|
67 |
# based on the search results and the user's query.
|
68 |
|
69 |
+
# Create a temporary file and return its path
|
70 |
+
with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as tmpfile:
|
71 |
+
tmpfile.write(b"placeholder_code = 'Odoo code will be generated here'")
|
72 |
+
return tmpfile.name
|
|
|
|