Fix code gen
Browse files- components.py +3 -3
components.py
CHANGED
@@ -201,10 +201,11 @@ class CodeTask(TaskComponent):
|
|
201 |
llm_call,
|
202 |
[
|
203 |
f"""
|
204 |
-
The following text should have a python function with some imports that
|
205 |
{raw_prompt_output}
|
206 |
|
207 |
-
Extract all the python packages
|
|
|
208 |
""",
|
209 |
f"""
|
210 |
The following text should have a python function and some imports:
|
@@ -239,7 +240,6 @@ class CodeTask(TaskComponent):
|
|
239 |
|
240 |
for p in eval(packages):
|
241 |
subprocess.check_call([sys.executable, "-m", "pip", "install", p])
|
242 |
-
__import__(p)
|
243 |
exec(function, locals())
|
244 |
# Should be last function in scope
|
245 |
self._toolkit_func = list(locals().items())[-1][1]
|
|
|
201 |
llm_call,
|
202 |
[
|
203 |
f"""
|
204 |
+
The following text should have a python function with some imports that need to be installed:
|
205 |
{raw_prompt_output}
|
206 |
|
207 |
+
Extract all the python packages that need to be installed with pip and nothing else.
|
208 |
+
Print them as a single python list that can be used with eval().
|
209 |
""",
|
210 |
f"""
|
211 |
The following text should have a python function and some imports:
|
|
|
240 |
|
241 |
for p in eval(packages):
|
242 |
subprocess.check_call([sys.executable, "-m", "pip", "install", p])
|
|
|
243 |
exec(function, locals())
|
244 |
# Should be last function in scope
|
245 |
self._toolkit_func = list(locals().items())[-1][1]
|