Call Functions In Sequence Using GPT-4 – Symphony

The Symphony allows you to write functions and have GPT-4 utilize them in real-time during conversations

symphony is an open-source AI tool for developers to write functions in Typescript and call them sequentially based on the conversation flow. Powered by OpenAI’s GPT-4 model.

How to use it:

1. Clone the repository from GitHub.

git clone https://github.com/symphony-hq/symphony project-name

2. Navigate into the directory and install dependencies.

cd project-name && yarn

3. Create an .env file in the root directory and add your OpenAI key:

OPENAI_API_KEY=...

4. Execute the following command, and your browser should automatically direct you to localhost:3000 where you’ll see the chat interface:

yarn nps start

5. For those looking to expand the chatbot’s capabilities, add new functions in the functions/ folder. Remember, symphony currently supports Typescript.

/**
 * @property {number} number Number in Kelvin.
 */
interface SymphonyRequest {
  number: number;
}
/**
 * @property {number} temperature Number in Celsius.
 */
interface SymphonyResponse {
  number: number;
}
/**
 * @description Converts Kelvin to Celsius.
 */
export default async function handler(
  request: SymphonyRequest
): Promise<SymphonyResponse> {
  const { number } = request;
  return {
    number: Math.round(number - 273.15),
  };
}

6. See it in action.

symphony Preview

Leave a Reply

Your email address will not be published. Required fields are marked *