ChatGPT-in-Slack icon indicating copy to clipboard operation
ChatGPT-in-Slack copied to clipboard

Enhancement: Pass Current DateTime to System Prompt for Improved Context Awareness

Open PeterDaveHello opened this issue 4 months ago • 3 comments

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!

PeterDaveHello avatar Jul 12 '25 20:07 PeterDaveHello

Yeah, this is a great idea!

seratch avatar Jul 12 '25 22:07 seratch

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!

iwamot avatar Jul 13 '25 00:07 iwamot

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.

seratch avatar Jul 13 '25 01:07 seratch