Tell a GPT exactly when to use an action, and in what format

Hi, I’m trying to create a very specific functionality in my GPT, and it relies on the GPT saying what API operation it will use before doing it, and only saying exactly that, and then starting by a specific part of the reply from the API in it’s response. It should behave like this:

User: Requesting some information
GPT: I will look for information X in location Y
(Call a specific operation in an API)
Headline response
Freeform reply from the GPT

I’ve almost gotten this to work but I’m running into a few issues:

  1. I cannot consistently get it to call the API after the short, initial description
  2. The short, initial description is sometimes not short at all
  3. If I try to write (Call operation X from the API) very explicitly and be too strict, it will just write (Call operation X from the API) in text without actually doing it

My biggest issue is that I don’t have a consistent way of telling the GPT that it should “use a specific API route”. I tried to make it explain exactly what it’s doing when it’s using an operation, but it said something very non-technical and eventually mentioned something about a jit-plugin, which I cannot find what it is.

Have you had any success in making the beginning of each response from your GPT act in a very precise way, and how did you do it?

I managed to solve this myself with enough trial and error. I documented my progress on my blog:

hörberg dot net slash blog