tech-envision commited on
Commit
9448a0a
·
unverified ·
2 Parent(s): 69e31cd 59f95d3

Merge pull request #38 from EnvisionMindCa/codex/locate-method-for-llm-internet-search-with-execute_terminal

Browse files
Files changed (3) hide show
  1. README.md +12 -8
  2. src/config.py +5 -3
  3. src/tools.py +4 -1
README.md CHANGED
@@ -6,11 +6,13 @@ database using Peewee. Histories are persisted per user and session so
6
  conversations can be resumed with context. One example tool is included:
7
 
8
  * **execute_terminal** – Executes a shell command inside a persistent Linux VM
9
- with network access. Use it to read uploaded documents under ``/data`` or run
10
- other commands. Output from ``stdout`` and ``stderr`` is captured and
11
- returned. Commands run asynchronously so the assistant can continue
12
- responding while they execute. The VM is created when a chat session starts
13
- and reused for all subsequent tool calls.
 
 
14
 
15
  Sessions share state through an in-memory registry so that only one generation
16
  can run at a time. Messages sent while a response is being produced are
@@ -19,9 +21,11 @@ pending response is cancelled and replaced with the new request.
19
 
20
  The application injects a robust system prompt on each request. The prompt
21
  guides the model to plan tool usage, execute commands sequentially and
22
- verify results before replying. It is **not** stored in the chat history but is
23
- provided at runtime so the assistant can orchestrate tool calls in sequence to
24
- fulfil the user's request reliably.
 
 
25
 
26
  ## Usage
27
 
 
6
  conversations can be resumed with context. One example tool is included:
7
 
8
  * **execute_terminal** – Executes a shell command inside a persistent Linux VM
9
+ with network access. Use it to read uploaded documents under ``/data``, fetch
10
+ web content via tools like ``curl`` or run any other commands. The assistant
11
+ must invoke this tool to search online when unsure about a response. Output
12
+ from ``stdout`` and ``stderr`` is captured and returned. Commands run
13
+ asynchronously so the assistant can continue responding while they execute.
14
+ The VM is created when a chat session starts and reused for all subsequent
15
+ tool calls.
16
 
17
  Sessions share state through an in-memory registry so that only one generation
18
  can run at a time. Messages sent while a response is being produced are
 
21
 
22
  The application injects a robust system prompt on each request. The prompt
23
  guides the model to plan tool usage, execute commands sequentially and
24
+ verify results before replying. When the assistant is uncertain, it is directed
25
+ to search the internet with ``execute_terminal`` before giving a final answer.
26
+ The prompt is **not** stored in the chat history but is provided at runtime so
27
+ the assistant can orchestrate tool calls in sequence to fulfil the user's
28
+ request reliably.
29
 
30
  ## Usage
31
 
src/config.py CHANGED
@@ -19,7 +19,9 @@ SYSTEM_PROMPT: Final[str] = (
19
  "tool returns its result you will receive a tool message and must continue from "
20
  "there. If the result arrives before your interim reply is complete, cancel the "
21
  "reply and incorporate the tool output instead. Uploaded files live under /data "
22
- "and are accessible via the execute_terminal tool. Continue using tools until "
23
- "you have gathered everything required to produce an accurate answer, then craft "
24
- "a clear and precise final response that fully addresses the request."
 
 
25
  )
 
19
  "tool returns its result you will receive a tool message and must continue from "
20
  "there. If the result arrives before your interim reply is complete, cancel the "
21
  "reply and incorporate the tool output instead. Uploaded files live under /data "
22
+ "and are accessible via the execute_terminal tool. When you are unsure about any "
23
+ "detail, you must use execute_terminal to search the internet or inspect files "
24
+ "before answering. Continue using tools until you have gathered everything "
25
+ "required to produce an accurate answer, then craft a clear and precise final "
26
+ "response that fully addresses the request."
27
  )
src/tools.py CHANGED
@@ -21,7 +21,10 @@ def set_vm(vm: LinuxVM | None) -> None:
21
  def execute_terminal(command: str) -> str:
22
  """
23
  Execute a shell command in a Ubuntu terminal.
24
- Use this tool to inspect uploaded documents under ``/data`` or run other commands.
 
 
 
25
 
26
  The command is executed with network access enabled. Output from both
27
  ``stdout`` and ``stderr`` is captured and returned. Commands are killed if
 
21
  def execute_terminal(command: str) -> str:
22
  """
23
  Execute a shell command in a Ubuntu terminal.
24
+ Use this tool to inspect uploaded documents under ``/data``, fetch web
25
+ content with utilities like ``curl`` or ``wget`` and run other commands.
26
+ The assistant must call this tool to search the internet whenever unsure
27
+ about any detail.
28
 
29
  The command is executed with network access enabled. Output from both
30
  ``stdout`` and ``stderr`` is captured and returned. Commands are killed if