News for hackers. Stuff that matters.

Show HN: Playground for OpenAI API with function calls

https://gpt342.s3.us-east-1.amazonaws.com/index.html

I was frustrated that open ai's playground lacks function calls, so I wrote my own more similar to ChatGpt!

Now I can:

* use the same models I program against

* have access to function calls

* can see how much it's costing me

Side benefit: I can share my API key with a friend so they can use Gpt3.5 & 4 as open ai took their deposit but still labelled their account as free tier - mistakes happen.

Prerequisite: an open ai api key

https://github.com/acover288/playgpt

Use at your own risk as I blindly installed npm packages.

( 6 comments | on HN )
Re:Show HN: Playground for OpenAI API with function calls by andsoitis on Monday July 17, 2023 @10:30AM (#36758671)
Do you store people's queries and/or the responses?
Re:Show HN: Playground for OpenAI API with function calls by acover on Monday July 17, 2023 @10:35AM (#36758738)
It's all hosted with AWS S3, I have no server.

In the future, I want to store the chat history in local storage with some search features.

Re:Show HN: Playground for OpenAI API with function calls by vikasr111 on Monday July 17, 2023 @11:41AM (#36759575)
Great first version of the project.
Re:Show HN: Playground for OpenAI API with function calls by acover on Monday July 17, 2023 @02:36PM (#36762173)
Thanks, I'm trying to get over the desire to perfect things before releasing them.
Re:Show HN: Playground for OpenAI API with function calls by jasonwcfan on Tuesday July 18, 2023 @01:05AM (#36768020)
Looks cool! One piece of feedback: It's really tedious to have to type in JSON. Making it a form would save tons of time having to write it out manually.
Re:Show HN: Playground for OpenAI API with function calls by acover on Sunday July 23, 2023 @02:06PM (#36837957)
I prefer text. If the JSON had very specific keys that needed values then a form would be very useful. However, the function_call api takes essentially arbitrary json, which would be very difficult to edit with a form interface. You'd need buttons for adding nested items, editing keys, editing values. It would be a mess.

Imagine creating the following simple function call:

  [
    {
      "name": "get_current_weather",
      "description": "Get the current weather in a given location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": ["celsius", "fahrenheit"]
          }
        },
        "required": ["location"]
      }
    }
  ]