feat: Add {{CURRENT_DATETIME}} variable support in Tool Prompts #4811

Closed
opened 2025-11-11 16:03:37 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @loong95 on GitHub (Apr 11, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

Hello Open WebUI team,

I'm currently working on implementing time-sensitive tools (like weather queries) and noticed a limitation in the tool calling system. While {{CURRENT_DATETIME}} works well in system prompts, this functionality isn't available in tool-specific prompts.

Current Challenge:
When implementing a tool like:

def get_weather(__user__: dict, date: str) -> str:
    # Returns weather for specified date

I want to handle queries like "What was yesterday's weather?" by referencing the current date in the tool prompt. However, since tool prompts don't support the {{CURRENT_DATETIME}} variable, I'm unable to:

  • Calculate relative dates (yesterday/tomorrow)

  • Provide time-aware responses

  • Maintain consistency with system prompt timestamps

This creates a disconnect between what the LLM understands (via system prompt) and what tools can access.

Desired Solution you'd like

Could we extend {{CURRENT_DATETIME}} support to tool calling prompts? This would enable proper time-awareness throughout the entire processing pipeline.

Alternatives Considered

No response

Additional Context

No response

Originally created by @loong95 on GitHub (Apr 11, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Problem Description Hello Open WebUI team, I'm currently working on implementing time-sensitive tools (like weather queries) and noticed a limitation in the tool calling system. While `{{CURRENT_DATETIME}}` works well in system prompts, this functionality isn't available in tool-specific prompts. Current Challenge: When implementing a tool like: ```python def get_weather(__user__: dict, date: str) -> str: # Returns weather for specified date ``` I want to handle queries like "What was yesterday's weather?" by referencing the current date in the tool prompt. However, since tool prompts don't support the `{{CURRENT_DATETIME}}` variable, I'm unable to: * Calculate relative dates (yesterday/tomorrow) * Provide time-aware responses * Maintain consistency with system prompt timestamps This creates a disconnect between what the LLM understands (via system prompt) and what tools can access. ### Desired Solution you'd like Could we extend `{{CURRENT_DATETIME}}` support to tool calling prompts? This would enable proper time-awareness throughout the entire processing pipeline. ### Alternatives Considered _No response_ ### Additional Context _No response_
Author
Owner

@tjbck commented on GitHub (Apr 11, 2025):

You should use the python built-in functions.

@tjbck commented on GitHub (Apr 11, 2025): You should use the python built-in functions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#4811