Skip to content

Commit

Permalink
Search with Bing if not specified (langchain-ai#15)
Browse files Browse the repository at this point in the history
search with Bing if not specified
  • Loading branch information
dashesy authored Apr 4, 2023
1 parent db57ac6 commit 47ee174
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions langchain/agents/assistant/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def _extract_tool_and_input(self, llm_output: str, tries=0) -> Optional[Tuple[st
action = "Image Understanding"
if not action_input:
if not action:
if cmd.endswith("?"):
if cmd.endswith("?") or sub_cmd.startswith("search "):
# if no image and no action
return "Bing Search" , cmd
return "Bing Search" , cmd
if tries < 4:
# Let the model rethink
return
Expand All @@ -149,6 +149,8 @@ def _extract_tool_and_input(self, llm_output: str, tries=0) -> Optional[Tuple[st
# TODO: separate llm to decide the task
if not action and (" is written" in sub_cmd or " text" in sub_cmd or sub_cmd.endswith(" say?")):
action = "OCR Understanding"
if not action and sub_cmd.startswith("search "):
action = "Bing Search"
if not action:
if tries < 4:
# Let the model rethink
Expand Down

0 comments on commit 47ee174

Please sign in to comment.