Skip to content

Instantly share code, notes, and snippets.

@feuyeux
Created February 28, 2024 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feuyeux/f27f5bbbdb401ccd050922f156bff5d3 to your computer and use it in GitHub Desktop.
Save feuyeux/f27f5bbbdb401ccd050922f156bff5d3 to your computer and use it in GitHub Desktop.
ReAct Sample
prompt = hub.pull("hwchase17/react")
llm = OpenAI()
tools = load_tools(["serpapi", "llm-math"], llm=llm)

agent = create_react_agent(llm, tools, prompt)

agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
agent_executor.invoke({"input": "How many seconds are in 1:23:45"})
> Entering new AgentExecutor chain...
 To find the number of seconds in a time format, I need to convert the hours and minutes into seconds first.
Action: Calculator
Action Input: 1 * 60 * 60 + 23 * 60 + 45Answer: 50255025 seconds
Action: Search
Action Input: "How many seconds in 1:23:45"['How Many Seconds in a Minute? ... There are 60 seconds in a minute. One minute is equal to 6 × 101 to unit of time second. Therefore 1 minute = 60 seconds. One ...', 'Free calculator to get the number of hours, minutes, and seconds between two times. Also, a full version to calculate the time duration between two dates.', 'This free time calculator can add or subtract time values in terms of number of days, hours, minutes, or seconds. Also, learn the different concepts of time.', 'Use this easy and mobile-friendly calculator to convert hours, minutes, and seconds into a decimal number of seconds. For example, 1 hour and 30 minutes is ...', 'The sidereal hour equals 59 minutes 50.17 seconds; the sidereal minute equals 59.8362 seconds; the sidereal second equals 0.997 270 second.', '60 sec. Conversion base : 1 min. = 60 sec. Conversion base : 1 sec. = 0.016666666666667 min.', "Just enter the raw hours, minutes, and seconds. If you're trying to find out how long ... minutes and seconds instead of hours, minutes, and seconds. Thanks to ...", 'In equation form: 1 second = 1 / (60 × 60) hours. How do I convert 1 hour in seconds? To convert 1 hour to seconds: Multiply ...', 'There are 60 seconds in a minute, which is why we use this value in the formula above. 1 min = 60 s. Minutes and seconds are both units used to measure time.', 'Minutes to Seconds (min to s) conversion calculator for Time conversions with additional tables and formulas.']60 seconds in a minute
Thought: I now know the final answer
Final Answer: 5025 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment