Sign in
Log inSign up
Krishna Chaitanya

13 likes

·

3.2K reads

1 comment

Peter Keyse
Peter Keyse
Sep 24, 2023

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.

10
·