whatsapp-chatgpt
whatsapp-chatgpt copied to clipboard
Providing Custom Context
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.
@navopw do you have any APIS design for this?
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 that's correct but, how to decide when to use custom_context? I mean what should be the condition for this?
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.
what if we add this statement before the message?
use this context only if the question provided below seems to be from the context.
Assign it to me and also merge my previous PR.