Agent = LLM + State + Tools
See this article for an overview of LLM agents.
This demo agent is a terminal-based chat interface to an agent that has some basic tools/actions.
Setup
- Clone the repo: https://github.com/ViktorQvarfordt/LLM-Agent-Demo
- Make sure you have
node
≥18 andpnpm
installed - Run
pnpm install
- Get an OpenAI API key: https://platform.openai.com/api-keys
Start
OPENAI_API_KEY='OMITTED' pnpm start
Example output
> Play music that fits the mood of the weather
<< Agent requests function calls: [ getCurrentLocation({}) ]
>> Submitting function outputs: [ "Stockholm, SE" ]
<< Agent requests function calls: [ getCurrentWeather({"location":"Stockholm, SE"}) ]
>> Submitting function outputs: [ "🌨 -7°C" ]
<< Agent requests function calls: [ playMusic({"songName":"Winter Winds","artistName":"Mumford & Sons"}) ]
>> Submitting function outputs: [ "Playing Winter Winds by Mumford & Sons" ]
< I've set "Winter Winds" by Mumford & Sons to play, which should match the chilly and snowy mood of the weather in Stockholm. Enjoy the music! 🎵❄️