You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: npcsh/llm_funcs.py
+32-23Lines changed: 32 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -802,15 +802,20 @@ def check_llm_command(
802
802
803
803
prompt=f"""
804
804
A user submitted this query: {command}
805
+
805
806
Determine the nature of the user's request:
806
-
1. Is it a specific request for a task that could be accomplished via a bash command or a simple python script that could be executed in a single bash call?
807
-
2. Should a tool be invoked to fulfill the request?
808
-
3. Is it a general question that requires an informative answer or a highly specific question that
807
+
808
+
1. Should a tool be invoked to fulfill the request?
809
+
810
+
2. Is it a general question that requires an informative answer or a highly specific question that
809
811
requires inforrmation on the web?
810
-
4. Would this question be best answered by an alternative NPC?
811
-
5. Is it a complex request that actually requires more than one
812
-
tool to be called, perhaps in a sequence?
813
-
6. is there a need for the user to provide additional input to fulfill the request?
812
+
813
+
3. Would this question be best answered by an alternative NPC?
814
+
815
+
4. Is it a complex request that actually requires more than one
816
+
tool to be called, perhaps in a sequence?
817
+
818
+
5. is there a need for the user to provide additional input to fulfill the request?
814
819
815
820
816
821
@@ -877,8 +882,12 @@ def check_llm_command(
877
882
878
883
prompt+=f"""
879
884
In considering how to answer this, consider:
880
-
- Whether it can be answered via a bash command on the user's computer. e.g. if a user is curious about file sizes within a directory or about processes running on their computer, these are likely best handled by a bash command.
881
-
- Whether more context from the user is required to adequately answer the question. e.g. if a user asks for a joke about their favorite city but they don't include the city , it would be helpful to ask for that information. Similarly, if a user asks to open a browser and to check the weather in a city, it would be helpful to ask for the city and which website or source to use.
885
+
886
+
- Whether more context from the user is required to adequately answer the question.
887
+
e.g. if a user asks for a joke about their favorite city but they don't include the city ,
888
+
it would be helpful to ask for that information. Similarly, if a user asks to open a browser
889
+
and to check the weather in a city, it would be helpful to ask for the city and which website
890
+
or source to use.
882
891
- Whether a tool should be used.
883
892
884
893
@@ -887,14 +896,17 @@ def check_llm_command(
887
896
extra tools or agent passes.
888
897
Only use tools or pass to other NPCs
889
898
when it is obvious that the answer needs to be as up-to-date as possible. For example,
890
-
a question about where mount everest is does not necessarily need to be answered by a tool call or an agent pass.
899
+
a question about where mount everest is does not necessarily need to be answered by a tool call or an agent pass.
891
900
Similarly, if a user asks to explain the plot of the aeneid, this can be answered without a tool call or agent pass.
892
-
If a user were to ask for the current weather in tokyo or the current price of bitcoin or who the mayor of a city is, then a tool call or agent pass may be appropriate. If a user asks about the process using the most ram or the biggest file in a directory, a bash command will be most appropriate.
901
+
902
+
If a user were to ask for the current weather in tokyo or the current price of bitcoin or who the mayor of a city is,
903
+
then a tool call or agent pass may be appropriate.
904
+
893
905
Tools are valuable but their use should be limited and purposeful to
894
906
ensure the best user experience.
895
907
896
908
Respond with a JSON object containing:
897
-
- "action": one of ["execute_command", "invoke_tool", "answer_question", "pass_to_npc", "execute_sequence", "request_input"]
909
+
- "action": one of ["invoke_tool", "answer_question", "pass_to_npc", "execute_sequence", "request_input"]
898
910
- "tool_name": : if action is "invoke_tool": the name of the tool to use.
899
911
else if action is "execute_sequence", a list of tool names to use.
900
912
- "explanation": a brief explanation of why you chose this action.
description: Execute scripts with a specified language. choose from python, bash, R, or javascript. Set the ultimate result as the "output" variable. It must be a string. Do not add unnecessary print statements.
3
+
inputs:
4
+
- code
5
+
- language
6
+
steps:
7
+
- engine: '{{ language }}'
8
+
code: |
9
+
{{code}}
10
+
- engine: natural
11
+
code: |
12
+
Here is the result of the code execution that an agent ran.
Copy file name to clipboardExpand all lines: npcsh/npc_team/tools/sql_executor.tool
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
-
tool_name: sql_executor
2
-
description: Execute SQL queries on the ~/npcsh_history.db and display the result. The database contains only information about conversations and other user-provided data. It does not store any information about individual files.
1
+
tool_name: data_pull
2
+
description: Execute queries on the ~/npcsh_history.db to pull data. The database contains only information about conversations and other user-provided data. It does not store any information about individual files.
3
3
inputs:
4
4
- sql_query
5
5
- interpret: false# Note that this is not a boolean, but a string
0 commit comments