Files
react-voice-agent/js_server/README.md
T
Jacob Lee 5bec194aa0 Adds TS example agent (#2)
* Adds TS example agent

* Adds README

* Fix calculator
2024-10-04 09:56:36 -07:00

1.5 KiB

🦜🎤 Voice ReAct Agent (TypeScript)

This is an implementation of a ReAct-style agent that uses OpenAI's new Realtime API. It is a light Hono app that statically serves a simple frontend from /src/static as well as a websocket endpoint for handling streaming audio input and output.

Specifically, we enable this model to call tools by providing it a list of LangChain tools. It is easy to write these custom tools, and you can easily pass these to the model.

Installation

Install required dependencies with yarn:

yarn

You will also need to copy the provided .env.example file to .env and fill in your OpenAI and Tavily keys.

Running the project

yarn dev

Open the browser

Now you can open the browser and navigate to http://localhost:3000 to see the project running.

Enable microphone

You may need to make sure that your browser can access your microphone.

Adding your own tools

You can add your own tools by adding them to the /src/tools.ts folder for TypeScript.

Adding your own custom instructions

You can add your own custom instructions by adding them to the /src/prompt.ts folder for TypeScript.

Next steps

  • Enable interrupting the AI
  • Enable changing of instructions/tools based on state
  • Add auth middleware