Skip to content

Commit

Permalink
Merge pull request #160 from hakeemo/main
Browse files Browse the repository at this point in the history
Ask user for more context to finish a task
  • Loading branch information
20001LastOrder authored Sep 21, 2023
2 parents 52823c7 + 54746d4 commit c53645d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/sherpa_ai/task_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def run(self, task: str) -> str:
tool = tools[action.name]

if tool.name == "UserInput":
return {"type": "user_input", "query": action.args["query"]}
return action.args["query"]

try:
observation = tool.run(action.args)
Expand Down
8 changes: 2 additions & 6 deletions src/sherpa_ai/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@


def get_tools(memory):
prompt = (
"You are an assistant helping user solve the task. Perform the task as writen"
"in the instruction.\nTask: {input}\nResult: "
)
prompt = Prompt.from_template(prompt)
tools = []

tools.append(ContextTool(memory=memory))
tools.append(UserInputTool())

if cfg.SERPER_API_KEY is not None:
search_tool = SearchTool(api_wrapper=GoogleSerperAPIWrapper())
Expand Down Expand Up @@ -151,7 +147,7 @@ class UserInputTool(BaseTool):
name = "UserInput"
description = (
"Access the user input for the task."
"You use this tool if you need further clarification of the task from the user."
"You use this tool if you need more context and would like to ask clarifying questions to solve the task"
)

def _run(self, query: str) -> str:
Expand Down

0 comments on commit c53645d

Please sign in to comment.