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

**URL:** <https://community.openai.com/t/on-using-the-messages-array-with-gpt-3-5-turbo-and-gpt-4/367376>\
**Category:** API\
**Tags:** gpt-4, gpt-35-turbo, api\
**Created:** [September 12, 2023, 11:17am UTC](https://community.openai.com/t/on-using-the-messages-array-with-gpt-3-5-turbo-and-gpt-4/367376 "2023-09-12T11:17:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PJK](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/pjk/32/25796_2.png) [@PJK](https://community.openai.com/u/PJK)\
**Post date:** [September 12, 2023, 11:17am UTC](https://community.openai.com/t/on-using-the-messages-array-with-gpt-3-5-turbo-and-gpt-4/367376/1 "2023-09-12T11:17:22Z")

</div>

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.

```auto
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.

```auto
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
  
  return;
}

```

**Hence this exercise uses four different APIs.**

---

<div class="post-metadata">

**Author:** ![Foxalabs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/foxalabs/32/738355_2.png) [@Foxalabs](https://community.openai.com/u/Foxalabs)\
**Post date:** [September 12, 2023, 11:35am UTC](https://community.openai.com/t/on-using-the-messages-array-with-gpt-3-5-turbo-and-gpt-4/367376/2 "2023-09-12T11:35:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [September 12, 2023, 11:49am UTC](https://community.openai.com/t/on-using-the-messages-array-with-gpt-3-5-turbo-and-gpt-4/367376/3 "2023-09-12T11:49:02Z")

</div>

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.

> [@PJK](#):
>
> …based on the assistant, Keywords, Entities and Summary

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.

---

<div class="post-metadata">

**Author:** ![PJK](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/pjk/32/25796_2.png) [@PJK](https://community.openai.com/u/PJK)\
**Post date:** [September 14, 2023, 9:29pm UTC](https://community.openai.com/t/on-using-the-messages-array-with-gpt-3-5-turbo-and-gpt-4/367376/4 "2023-09-14T21:29:04Z")

</div>

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:

```auto
 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.
