-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add current date in UTC to PromptBuilder #8233
Conversation
Pull Request Test Coverage Report for Build 10766224472Details
💛 - Coveralls |
Looks good to me but can we maybe use a syntax similar to what this extension does? I think it's more versatile and will make it easier to add functionalities in the future. |
Hey @silvanocerza I think that sounds like a good idea! Unfortunately, that's a bit more involved and @medsriha and I wouldn't have time to implement that right now. Would it be better to close this PR and open a new issue? |
This version uses the same syntax as in this extension by leveraging arrow. The default date format is |
# Default Add when no operator is provided | ||
operator = "+" if isinstance(node, nodes.Add) else "-" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this read "# Default Minus when ..." since the else statement is "-"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@medsriha thanks for the work on this! This looks good to me. What do you think @silvanocerza ?
Related Issues
Proposed Changes:
Feature: Added a
utc_now
function in thePromptBuilder
so the current date can be displayed inside theTemplate
.This function returns the current date and time in UTC format as a string. The default format is
%Y-%m-%d %H:%M:%S.%f
, but users can specify their own format as long as it's ISO compatible. The function has also been added as a global in the Jinja2 environment, so it can be accessed directly from the template. Input validation has been implemented to ensure that the date format is valid.How did you test it?
Added unit tests to ensure the
utc_now
function returns correct UTC timestamps in various formats and handles invalid date formats.Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.