---
title: "Comment by Peter Keyse on \"Unleash the Power of GPT-4 API & Google Sheets: A Step-by-Step Guide to Integration\" | Hashnode"
description: "Very nicely written Krishna Chaitanya May I share a thought on using the messages array with OpenAI&#39;s gpt-4 and gpt-3.5-turbo APIs. I use messages to help m"
url: "https://hashnode.com/posts/unleash-the-power-of-gpt-4-api-google-sheets-a-step-by-step-guide-to-integration/641bd1de108a964a86a391f1/comment/6510097d3dd903406188bfce"
---

[Discussion](https://hashnode.com/posts/unleash-the-power-of-gpt-4-api-google-sheets-a-step-by-step-guide-to-integration/641bd1de108a964a86a391f1)

Comment [Unleash the Power of GPT-4 API & Google Sheets: A Step-by-Step Guide to Integration](https://hashnode.com/posts/unleash-the-power-of-gpt-4-api-google-sheets-a-step-by-step-guide-to-integration/641bd1de108a964a86a391f1)

[Peter Keyse](https://hashnode.com/@theScribe)

[Sep 24, 2023](https://hashnode.com/posts/unleash-the-power-of-gpt-4-api-google-sheets-a-step-by-step-guide-to-integration/641bd1de108a964a86a391f1/comment/6510097d3dd903406188bfce)

Very nicely written Krishna Chaitanya

May I share a thought on using the messages array with OpenAI's gpt-4 and gpt-3.5-turbo APIs. I use messages to help maintain conversational flow by recycling the chat history and adding an NLP analysis.

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 }, \]

Topic, LastPrompt, LastResponse, Keywords, Entities, Summary and new Ideas are ranges in the sheet and are used to prime the follow-up prompt. The NLP is generated by the Do\_NLP\_Analysis() executed prior to sending the prompt to the LLM.

function Do\_NLP\_Analysis() {

// generate an NLP analysis

Keywords = Do\_Keywords() // uses fast-gpt-j

Summary = Do\_Summary() // uses finetuned-gpt-neox-20b or Cohere Summarization

Entities = Do\_Entities() // uses Google Cloud Natural Language

Ideas = Do\_Ideas() // uses either gpt-4 or gpt-3.5-turbo

return; }

Get() is a simple library function that gets the value of a range in the sheet.

It works for me.
