I want to create few shot example with Assistants API

Hello everyone,
I would appreciate help with creating few shot example. Before the Assistants APi, with chat.completions, I just added a few messages with user and assistant. But now it seems that the “assistant” role is disabled to add to messages.

Should I add a few shot example to assistant’s instructions? Or where should it go when I cannot do it with using roles and creating example messages with task and solution?

Thanks a lot, hope my question is clear.

3 Likes

I have been playing with the assistants a lot and mostly found that the longer and more detailed my instructions are the better the assistant does what I want it to do. It can be a little frustrating at times but most of my assistants are at least a full page prompt, some more. Some of the prompts include specific examples.
The thing I have struggled with most with to get consistent is output in JSON. I ended up having a separate paragraph at the end of the prompt, like a mini chapter titles 'Output formatting instructions" that tells the assistant exactly that it needs to, every time output ONLY a JSON object and with what attributes.

What is really great about the Assistants is that you now have 32k space for JUST your prompt, so you really can put in an enormous prompt, including a lot of ‘shots’. Organizing them properly will take a bit of trial and error.

Thank you a lot for this, I appreciate that!
Because I’m experiencing the same struggle with JSON.
Good to know that longer prompt helps in your case. Will try that.

t.

Here’s an actual example, at the end of one of my Assistant prompts:

Response format instructions: The response will be a single JSON object with one attribute ‘Reasoning’ that has the text with your reasoning and one attribute ‘Assessment’ that has REJECTED, POSSIBLE or GREAT FIT. There will be no text or other characters outside the JSON string.

2 Likes

that’s very helpful. Can you provide an example of how you include the ‘shots’ in your prompt?

Maybe you can be a little bit more specific about what your looking for or what you are struggling with? There are so many ways depending on the tasks. My Assistants do a lot of administrative tasks that have a very detailed, descriptive prompt that tells the what check what to do (function calls) and then what to output. Happy to help!

2 Likes

I think what they’re asking is how to word it something like this. You are a custom AI assistant that helps with the implementation of (x). You do this by performing (y) and (z) as the expected steps to take in regards to the puts of (a) and (b). Given that your goal is to perform x and the steps that you would take are y and z using the tools like a and b in situations similar to… " a couple different examples here" And your goal is to end up with an output like (desired output). For example, in this prompt you are going to perform x using y and z with a and b to get expected outcome. Now whenever a user messages you try to determine which way to satisfy their requirements with the resources available to you and the demonstration included in this system prompt.

2 Likes

I need to do a combination of items that need to be arranged by the assistant under some rules, for example [item 2, item 23, item 1]. The thing is that I don’t know in what format to tell the few shot examples, since this is different from the chat.completion.