whatsapp-chatgpt icon indicating copy to clipboard operation
whatsapp-chatgpt copied to clipboard

Providing Custom Context

Open Zain-ul-din opened this issue 2 years ago • 6 comments

It would be nice if we let users add their own context.

Example

const custom_context = `
 Context:
 RandomsTS is a free and open-source framework for building restful APIS 
 using typescript and class-based object-oriented programming.
 Key Features: file-base routing, Hot-reloading, Type safety, Intuitive APIs.
 
 NOTE! Only answer from the given context
 question: 
 <add user_message here>
`

const canUseCustomContext = messageStr.includes("RandomsTS");
if (canUseCustomContext) 
{
  // add custom_context before user message
  await handleMessageGPT(message, custom_context+prompt)
}

Results

 message:- what is RandomsTS
 
 reply:- RandomsTS is a free and open-source framework for building restful APIS 
 using typescript and class-based object-oriented programming.

Zain-ul-din avatar Feb 19 '23 12:02 Zain-ul-din

@navopw do you have any APIS design for this?

Zain-ul-din avatar Feb 19 '23 12:02 Zain-ul-din

We can add a PRE_PROMPT to environment variables which is sent to GPT on initialization of a conversation.

Did I understand this issue (enhancement) correct?

navopw avatar Feb 19 '23 12:02 navopw

@navopw that's correct but, how to decide when to use custom_context? I mean what should be the condition for this?

Zain-ul-din avatar Feb 19 '23 12:02 Zain-ul-din

We can name the env variable CUSTOM_CONTEXT.

If the environment variable is set, always use custom context.

This is nice for creating actual chat bots that understand custom problems/solutions.

navopw avatar Feb 19 '23 12:02 navopw

what if we add this statement before the message?

use this context only if the question provided below seems to be from the context.

Zain-ul-din avatar Feb 19 '23 12:02 Zain-ul-din

Assign it to me and also merge my previous PR.

Zain-ul-din avatar Feb 19 '23 12:02 Zain-ul-din