I am creating a chatbot for my flatmates and me. It’s a small python script that should keep track of our shared shopping list. I want to use gpt3.5 to parse free text messages and find out if the user wants to add or remove items from the list, retrieve the list or delete the list. I am currently doing this:
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": 'Interpret the following user input and convert it into JSON of the form {"cleaningtask": boolean, "shoppinglist":[{"action":"add"|"remove"|"list"|"clear", "items": ["string"]}]. Only return JSON. User input:'},
{"role": "user", "content": message}
]
)
It works perfect in chatGPT (also using gpt3.5), but the API gives me flaky results (is it because I’m using the system role perhaps? It adds punctuation to the end of the JSON object, or it says stuff like “Sure, here is your JSON:”.
Am I using the wrong tool for the job? Are there other simple tools that could do it better? Should I improve my prompt?