Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bugbug/tools/code_review/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import json
import os
from datetime import datetime
from datetime import UTC, datetime
from logging import getLogger
from typing import Optional

Expand Down Expand Up @@ -61,6 +61,10 @@
logger = getLogger(__name__)


def current_date_for_prompt() -> str:
return datetime.now(UTC).date().isoformat()


class CodeReviewTool(GenerativeModelTool):
version = 2

Expand Down Expand Up @@ -209,6 +213,7 @@ def generate_initial_prompt(
created_before = patch.date_created if self.is_experiment_env else None

return FIRST_MESSAGE_TEMPLATE.format(
current_date=current_date_for_prompt(),
patch=format_patch_set(patch.patch_set),
patch_summarization=patch_summary,
external_context=external_context,
Expand Down
4 changes: 3 additions & 1 deletion bugbug/tools/code_review/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@
"""


FIRST_MESSAGE_TEMPLATE = """Here is a summary of the patch:
FIRST_MESSAGE_TEMPLATE = """Current date: {current_date}
Here is a summary of the patch:
<patch_summary>
{patch_summarization}
Expand Down