harshav17 / chat-with-functions

playground

Home Page:https://chat-with-functions.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo

Checkout it out!

Getting Started

Create .env.local in the root folder. Place the following vars.

OPENAI_API_KEY=<>
MODEL=<gpt-3.5-turbo-0613 OR gpt-4-0613>

First, run the development server:

npm run dev

Create functions the GPT can use

Checkout utils/funcs.ts to see the currently available functions. Here's a hopefully up to date list. See demo above for usage hints.

  1. addDecimalValues: Adds two decimal values.

  2. addHexadecimalValues: Adds two hexadecimal values.

  3. getCurrentWeather: Given a lat and long, gets the current weather. This uses OpenWeather API. Navigate to OpenWeather to get yourself an account. Grab the API key and paste it in .env.local.

  4. generateImage: Generate an image from a prompt.

OPEN_WEATHER_API_KEY=<>
HF_API_KEY=<>
AWS_ACCESS_KEY_ID=<>
AWS_S3_SECRET_ACCESS_KEY=<>
AWS_REGION=<>
  1. Want to write your own? All your need to do is the following...

    1. Navigate to utils/funcs.ts and write a new function.
    2. Make sure add export keyword to the function.
    3. Define function definition in functionsForModel property inside utils/funcs.ts.
    4. Chat away!

About

playground

https://chat-with-functions.vercel.app


Languages

Language:TypeScript 84.5%Language:JavaScript 9.1%Language:CSS 6.4%