Skip to content

Commit

Permalink
Commit before synchronizing with master
Browse files Browse the repository at this point in the history
  • Loading branch information
HalberdOfPineapple committed Jun 26, 2023
1 parent 97f7ace commit 8917b15
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
4 changes: 3 additions & 1 deletion camel/agents/ReAct_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
You should use Thought to describe your thoughts about your plan to obtain information related to the target task.
And you should use Action to indicate what actions should be done, and then return.
Each action statement should be in the format: Action[<action_input>]
You do not need to output any observation! The observations will be obtained by the external tool executing the action you selected and be provided to you.
When there are multiple search-related actions available, consider using others when one search engine fails.
Expand All @@ -44,7 +45,7 @@
Here are is an example session (this example is only for presentation and works only if the available actions include "Search")
Task: Answer the question: What is the capital of France?
Thought: I should look up France on Wikipedia
Thought: To answer this question, I should search for information about France.
Action: Search[France]
At this point you should return. And you will be called again with this:
Expand All @@ -69,6 +70,7 @@

def parse_action(act_str):
# example act_str: Search[entity]
print(f"Action string: {act_str}")
action = act_str.split('[')[0]
action_input = act_str[:-1].split('[')[1]
return action, action_input
Expand Down
11 changes: 1 addition & 10 deletions camel/agents/tool_agents/Google_tool_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,11 @@ def __init__(
self.search = SerpAPIWrapper(serpapi_api_key=SAK)

self.name = name
# self.description = f"""The `{self.name}` is a tool agent that can perform Google search when external information is needed.
# Here are some python code examples of what you can do with this agent:
# # Ask commonsense information:
# ans = {self.name}.step("What is the name of the 45th President of the United States?")

# # Ask real-time information like weather
# ans = {self.name}.step("What is the current weather of London?")
# """

self.description = \
f"""
GoogleSearch[<keyword>]
- input <keyword>: the information to be searched using Google search engine
- Keep a rule in mind: if the current search does not return valid page, try to make the search item more general and shorter instead of making it finer
- Keep a rule in mind: if the current search does not return valid page, try to make the search item more general and shorter, instead of making it finer
- Example usage: GoogleSearch[What is the current weather of London?]
- by which we can obtain the weather information in London through Google
"""
Expand Down
15 changes: 9 additions & 6 deletions examples/ReAct/tool_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,23 @@ def main():
print("Creating ReActAgent...")
react_agent = ReActAgent(
sys_msg,
model=ModelType.GPT_3_5_TURBO,
verbose=True,
action_space=action_space,
)

print("Passing message into the ReActAgent...")
# question = "Were Scott Derrickson and Ed Wood of the same nationality?"
# question = "What female sports league does the oldest football association in Africa includes?"
question = "Within which sports complex is this sports facility located where 1990 FIFA World Cup Final between West Germany and Argentina took place?"
question = "What female sports league does the oldest football association in Africa includes?"
# question = "Within which sports complex is this sports facility located where 1990 FIFA World Cup Final between West Germany and Argentina took place?"
# question = "American politician Joe Heck ran unsuccessfully against Democrat Catherine Cortez Masto, a woman who previously served as the 32nd Attorney General of where?"

# content = f"Answer the question: {question}"

content = "Write a python program implementing linear regression"
user_msg = UserChatMessage(
role_name=role_name,
content=(
f"Answer the question: {question}"
))
content=content
)
output_message, _, _ = react_agent.step(user_msg)
# print(output_message.content)

Expand Down

0 comments on commit 8917b15

Please sign in to comment.