Skip to content

RSPEED-2521: include today's date in rlsapi v1 system prompt#1260

Merged
tisnik merged 1 commit intolightspeed-core:mainfrom
major:rspeed-2521/rlsapi-v1-date-in-prompt
Mar 3, 2026
Merged

RSPEED-2521: include today's date in rlsapi v1 system prompt#1260
tisnik merged 1 commit intolightspeed-core:mainfrom
major:rspeed-2521/rlsapi-v1-date-in-prompt

Conversation

@major
Copy link
Contributor

@major major commented Mar 3, 2026

Description

Include today's date in the rlsapi v1 system prompt so the LLM has temporal awareness for date-sensitive questions (e.g., "when does RHEL 9 reach end of life?"). This matches the existing pattern in rlsapi, where the date is formatted as "%B %d, %Y" and injected into the system prompt context.

_build_instructions() now always appends Today's date: March 03, 2026 as a separate line between the base prompt and the User's system: context block.

Type of change

  • New feature

Tools used to create PR

  • Assisted-by: Claude (opencode)
  • Generated by: N/A

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  1. uv run pytest tests/unit/app/endpoints/test_rlsapi_v1.py -x -q (33 tests pass)
  2. uv run make format (clean)
  3. uv run make verify (all linters pass, mypy clean)
  4. Verified the date regex pattern Today's date: \w+ \d{2}, \d{4} matches in all _build_instructions test cases

Summary by CodeRabbit

  • New Features
    • LLM prompts now automatically include today's date to provide better temporal context for AI-generated responses.

Add today's date to the LLM instructions built by _build_instructions()
so the model has temporal awareness for date-sensitive questions. The
date appears as a separate line between the base prompt and the system
context, matching how rlsapi handles it.

Signed-off-by: Major Hayden <major@redhat.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e07897c and 7b6503e.

📒 Files selected for processing (2)
  • src/app/endpoints/rlsapi_v1.py
  • tests/unit/app/endpoints/test_rlsapi_v1.py

Walkthrough

The PR modifies the _build_instructions function in the RLS API endpoint to include the current date in the system prompt sent to the LLM. Date information is appended regardless of whether custom system information is present.

Changes

Cohort / File(s) Summary
Core Implementation
src/app/endpoints/rlsapi_v1.py
Added datetime import and updated _build_instructions to append "Today's date: " to the prompt, with the date formatted as Month DD, YYYY. Date is included both when system info is absent and when it's present.
Unit Tests
tests/unit/app/endpoints/test_rlsapi_v1.py
Updated test_build_instructions and test_build_instructions_no_customization to verify the date string is present in the output, replacing exact equality checks with string prefix and inclusion assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • tisnik
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding today's date to the rlsapi v1 system prompt.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@tisnik tisnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I'm a bit worried about now() and not utcnow() or today() but I guess this is exactly what you need

@major
Copy link
Contributor Author

major commented Mar 3, 2026

@tisnik The date doesn't have to be super precise for this particular use case. ;)

@tisnik tisnik merged commit 005dd39 into lightspeed-core:main Mar 3, 2026
20 of 21 checks passed
@major major deleted the rspeed-2521/rlsapi-v1-date-in-prompt branch March 3, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants