convert few shot learning example to API

174 Views Asked by At

I have made a little example of few shot sentiment analysis using the GUI of OPENAI and it seems to work reasonably well. I would now like to convert this into API code, but I am struggling to see a minimal example of how to do this.

On the GUI, I do the following:

description: classify titles into categories
Input: Manchester united seals win over Mancester city
Output: {"category":"football"}
Title: Australia win ashes away from home
Output: {"category":"cricket"}
Title: Lewis hamilton fastest in qualifying
Output: {"category":"formula 1"}
Title: Bayer Munich goal keeper injured
Output: {"category":"football"}
Input: Stuart broad retires from english cricket
Output: {"category":"cricket"}
Input: Verstappen clashes with Bottas in 2023 F1 series
Output: {"category":"formula 1"}
Input: England to tour west indies for 5 nations cricket cup

OpenAI output:
Output: {"category":"cricket"}

I would like to convert this to an API but I am not able to find a minimum example for such few shot prompts.

any help would be greatly appreciated.

0

There are 0 best solutions below