ChatGPT-in-Slack
ChatGPT-in-Slack copied to clipboard
Enhancement: Pass Current DateTime to System Prompt for Improved Context Awareness
To enhance the AI bot’s context awareness and reduce hallucinations caused by outdated training data, I suggest including the current server date and time as part of the system prompt.
This allows the bot to accurately reference today’s date, minimizing confusion about the present timeline, even if it cannot access real-time external data.
If this proposal is accepted, I’d also be happy to find some time to contribute a PR for the implementation.
Thanks for considering!
Yeah, this is a great idea!
Great idea!
One small concern: adding the current date/time to the system prompt may disable prompt caching, which could increase costs. It might be nice to make this optional via an environment variable, so users can choose.
Just wanted to share this thought. Thanks!
Introducing EMBEDDING_TIME_IN_SYSTEM_PROMPT = true (default: false) is a reasonable option. Specifically, regarding OpenAI’s prompt caching: if the prompt is shorter than 1024 tokens, it isn’t cached. This means the app’s default system prompt doesn’t benefit from caching. However, having the flag as an option is still useful.
Also, if we add a timestamp to the system prompt, it’s recommended to append it at the end. For more details, see https://platform.openai.com/docs/guides/prompt-caching#how-it-works. If your custom prompt is longer than 1K tokens, this approach helps maintain caching.