On using the Messages array with 'gpt-3.5-turbo' and 'gpt-4'

Have finally found a use for the message array in the data that’s sent to these engines.

e.g. in the function Get_Ideas() are these messages.

messages: [
        { "role": "system", "content": topic },
        { "role": "assistant", "content": history },
        { "role": "user", "content": Get("Keywords") },
        { "role": "user", "content": Get("Entities") },
        { "role": "user", "content": Get("Summary") },
        { "role": "user", "content": prompt },

The prompt = “make observations and appropriate and expansive suggestions based on the assistant, Keywords, Entities and Summary” and the topic, history are defined in this function. The Keywords, Entities and Summary, which prime the prompt, are the product of an NLP analysis.

function Do_NLP_Analysis() {
  // do an NLP analysis
  Keywords = Do_Keywords() // uses fast-gpt-j
  Summary = Do_Summary() // uses finetuned-gpt-neox-20b
  Entities = Do_Entities() // uses Google Cloud Natural Language

Hence this exercise uses four different APIs.

1 Like

Interesting use for it, I’ve also seen it used to allow for multiple speakers in a conversation where the AI is but one of them.

This is an interesting use. One could expect the AI to interpret this as though it was all user input, perhaps similar meaning to the AI as if it was all passed in one role.

It also, though could be seen as more likely to be out-of-context. The AI can take a series of user inputs like that, like a chat history with the AI replies omitted, and understand that the prior user inputs are the turns of earlier questions, just a topic to be remembered.

In your prompt, you refer to these, but it seems you’re not guaranteeing the AI knows what you are talking about.

You might want to ensure some contextual understanding for each role’s data by text injection, such as f"Documentation - here’s keywords for my query: {keyword_string}", and so on.

Thanks for your thoughtful observations and I have tried to test for your caution. From what I’ve seen the engine progresses sequentially through the user/content statements and is evaluating the keywords, entities and (newly added) - Ideas = Do_Ideas() // uses either GPT-4 or 3.5-turbo

Hence message has progressed to:

 messages: [
        { role: "system", content: topic },
        { role: "assistant", content: LastPrompt},
        { role: "assistant", content: LastResponse },
        { role: "user",  content: Get("Keywords") },
        { role: "user", content: Get("Entities") },
        { role: "user", content: Get('Summary') },
        { role: "user", content: Get('GPT_Ideas') },

        { role: "user", content: prompt },

Would love to hear if others are going this way as it seems a solid line of progression and potentially fruitful.