Skip to content

Commit 0980050

Browse files
authored
Merge pull request #98 from cagostino/chris/calc_tool_bug
Chris/calc tool bug
2 parents 4ef9197 + d672118 commit 0980050

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

npcsh/llm_funcs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,14 +1051,14 @@ def handle_tool_call(
10511051
for inp in required_inputs:
10521052
if not isinstance(inp, dict):
10531053
# dicts contain the keywords so its fine if theyre missing from the inputs.
1054-
if inp not in input_values:
1054+
if inp not in input_values or input_values[inp] == "":
10551055
missing_inputs.append(inp)
10561056
if len(missing_inputs) > 0:
10571057
# print(f"Missing required inputs for tool '{tool_name}': {missing_inputs}")
10581058
if attempt < n_attempts:
10591059
print(f"attempt {attempt+1} to generate inputs failed, trying again")
10601060
print("missing inputs", missing_inputs)
1061-
print("llm response", response)
1061+
#print("llm response", response)
10621062
print("input values", input_values)
10631063
return handle_tool_call(
10641064
command,
@@ -1080,6 +1080,7 @@ def handle_tool_call(
10801080
}
10811081

10821082
# try:
1083+
print("Executing tool with input values:", input_values)
10831084
tool_output = tool.execute(
10841085
input_values,
10851086
npc.all_tools_dict,

npcsh/npc_compiler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ def execute_step(
222222
context["results"] = exec_env["output"]
223223
except NameError as e:
224224
print(f"NameError: {e} , on the following tool code: ", rendered_code)
225+
except SyntaxError as e:
226+
print(f"SyntaxError: {e} , on the following tool code: ", rendered_code)
227+
except Exception as e:
228+
print(f"Error executing Python code: {e}")
229+
225230
return context
226231

227232
def to_dict(self):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_setup_message():
5757

5858
setup(
5959
name="npcsh",
60-
version="0.3.8",
60+
version="0.3.9",
6161
packages=find_packages(exclude=["tests*"]),
6262
install_requires=[
6363
"redis",

0 commit comments

Comments
 (0)