scrimba
AI Engineering
AI Agents
ReAct Agent - part 2 - ReAct prompt
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

ReAct Agent - part 2 - ReAct prompt
AboutCommentsNotes
ReAct Agent - part 2 - ReAct prompt
Expand for more info
index.js
run
preview
console
import OpenAI from "openai"
import { getCurrentWeather, getLocation } from "./tools"

export const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
dangerouslyAllowBrowser: true
})

/**
* Goal - build an agent that can answer any questions that might require knowledge about my current location and the current weather at my location.
*/

/**
PLAN:
1. Design a well-written ReAct prompt
2. Build a loop for my agent to run in.
3. Parse any actions that the LLM determines are necessary
4. End condition - final Answer is given

*/







// const response = await openai.chat.completions.create({
// model: "gpt-3.5-turbo",
// messages: [
// {
// role: "user",
// content: `Give me a list of activity ideas based on my current location of ${location} and weather of ${weather}`
// }
// ]
// })

// console.log(response.choices[0].message.content)
Console
"1. Visit Salt Lake City Public Library: Take advantage of the sunny weather to walk around this architectural masterpiece and the vibrant community gathering place. 2. Explore Antelope Island State Park: Watch wild bison and hike the trails. It's just the perfect day with 72°F to explore the natural wonders of the area. 3. Head to Sugar House Park: You can run, walk, or jog around the area. Don't forget to have a picnic under the sun. 4. Visit Temple Square: Rich with history, architecture, and stunning landscaped gardens, Temple Square is an iconic location in the city. 5. Stroll around Red Butte Garden: Enjoy the mild weather in this botanical garden, arboretum, and amphitheater. 6. Enjoy the Outdoors at Liberty Park: Perfect weather to rent a paddle boat, visit the aviary or even just have a barbeque. 7. Visit the Natural History Museum of Utah: If you feel like taking a break from the sunshine, step inside this museum to learn about Utah's natural history. 8. Hiking Big Cottonwood Canyon: Keep your water bottle and sunscreen handy and enjoy the hike under the clear skies. 9. Bike the Jordan River Parkway Trail: Enjoy a leisurely cycle along this scenic path. 10. Salt Lake City Farmer's Market: Take advantage of the beautiful weather to purchase some local produce or handmade goods and enjoy local live performances. 11. Take a Ride on the Salt Lake Trolley: Sightsee Salt Lake City's attractions under the comfortable weather. 12. Explore Bonneville Shoreline Trail: Perfect for biking, hiking or running with a beautiful view over the surroundings. 13. Visit Hogle Zoo: A sunny and warm day is perfect to explore more than 800 animals from all over the world. 14. Golfing: With the sunny weather, why not go out and play some Golf in any of the immaculate courses around the city. 15. Paddleboarding or Kayaking in Great Salt Lake: Make the most of this perfect weather by enjoying water sports in the Great Salt Lake. Make sure to follow any local guidelines or restrictions due to the ongoing pandemic situation. Enjoy your day in Salt Lake City!"
,
/index.html
-3:29