Inferensys

Prompt

Upcoming and Next Temporal Intent Disambiguation Prompt

A practical prompt playbook for resolving 'next Friday' and 'upcoming' temporal intent into explicit date ranges in production calendar and scheduling RAG workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job, ideal user, and constraints for the Upcoming and Next Temporal Intent Disambiguation Prompt.

This prompt is designed for calendar, scheduling, and event-driven RAG systems where a user query contains a forward-looking temporal reference like 'next Friday,' 'upcoming earnings,' or 'the next team standup.' The core job is intent disambiguation: does the user mean the single chronologically immediate instance of that event, or are they referring to a broader future period? A naive date parser will fail here because the correct answer depends on context, the current date, and the nature of the event itself. The ideal user is a RAG developer or search engineer building a retrieval pipeline over a time-sensitive corpus (meetings, earnings calls, release schedules, maintenance windows) where resolving this intent correctly is the difference between retrieving the right document and retrieving a stale or irrelevant one.

You should use this prompt when your system must convert an ambiguous 'upcoming' or 'next' reference into a concrete, machine-readable date range or a set of candidate ranges with confidence scores. The prompt requires a reference date (usually the current date or the user's 'today'), the user's raw query, and optionally a known event catalog or schedule context. It is not a general-purpose date parser. Do not use this prompt for historical queries ('last Friday'), for queries with explicit absolute dates ('on March 3rd'), or for simple relative date normalization that doesn't involve event anchoring. Those tasks are better served by the Relative Date Normalization or Temporal Expression to ISO 8601 Conversion prompts in this pillar.

The primary failure mode this prompt addresses is the 'Friday Problem': if today is Wednesday the 10th, does 'next Friday' mean the 12th (the immediate upcoming Friday) or the 19th (the Friday of next week)? The answer varies by dialect, region, and even corporate culture. This prompt forces the model to reason aloud about the ambiguity, anchor its decision to a stated convention or event context, and output a structured result that your application can validate. Before deploying, you must test this prompt against a golden dataset of queries with known intent labels for your specific domain and locale. If the output will drive a high-stakes action like a missed meeting or a financial trade, always route low-confidence disambiguations to a human for confirmation rather than silently defaulting to one interpretation.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Upcoming and Next Temporal Intent Disambiguation Prompt works and where it introduces risk. Use these cards to decide if this prompt fits your retrieval pipeline before you integrate it.

01

Good Fit: Calendar-Driven Scheduling Queries

Use when: users ask about 'next Friday', 'upcoming meeting', or 'next earnings call' and your system must resolve the immediately upcoming instance. Guardrail: Always inject a reference timestamp from the user's timezone so 'next' resolves relative to now, not the model's training cutoff.

02

Good Fit: Event-Anchored Temporal References

Use when: queries reference events like 'upcoming after the Q2 report' or 'next release following the security patch'. Guardrail: Require the event anchor to be resolved to a concrete date before disambiguation runs. If the anchor date is missing or ambiguous, escalate to clarification rather than guessing.

03

Bad Fit: Recurring Pattern Without Instance Resolution

Avoid when: the user asks 'every Friday' or 'weekly status' without a specific upcoming instance. This prompt resolves the next single occurrence, not recurring schedules. Guardrail: Route recurring-interval queries to a schedule expansion prompt instead of forcing single-instance disambiguation.

04

Bad Fit: Vague Intent Without Temporal Anchoring

Avoid when: queries like 'what's coming up' or 'future plans' lack any temporal anchor or event reference. The prompt cannot reliably choose between immediate upcoming and broader future periods. Guardrail: Detect missing anchors and return a clarification request rather than hallucinating a default range.

05

Required Input: Reference Timestamp and Timezone

Risk: Without an explicit reference datetime, 'next Friday' resolves inconsistently across model invocations or timezones. Guardrail: Always pass a reference_datetime in ISO 8601 with timezone offset. Validate that the timezone matches the user's locale before disambiguation runs.

06

Operational Risk: Weekday Boundary Logic Errors

Risk: 'Next Friday' on a Thursday should return tomorrow, but on a Friday it should return 7 days later. Boundary logic fails silently in production. Guardrail: Include eval test cases for same-day, next-day, and end-of-week boundaries. Run these tests in CI before every prompt version deployment.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt that disambiguates 'upcoming' and 'next' temporal references into explicit date ranges with intent classification.

This prompt template resolves the ambiguity inherent in phrases like 'next Friday', 'upcoming earnings', or 'the next meeting'. The core challenge is that 'next' can mean the immediately upcoming instance or the instance in the following calendar period, and 'upcoming' can refer to a single event or a forward-looking window. The prompt forces the model to classify the user's likely intent and produce a concrete date range, making it suitable for calendar, scheduling, and event-driven RAG systems where retrieval requires explicit boundaries.

Below is the copy-ready prompt template. All square-bracket placeholders must be replaced by your application before sending the request. The [REFERENCE_DATE] anchors all relative time calculations. [EVENT_CATALOG] provides known event definitions when the query references named events like 'earnings' or 'product launch'. [OUTPUT_SCHEMA] enforces a structured response your parser can consume. [WEEK_START] disambiguates week boundaries across locales.

text
You are a temporal intent disambiguation engine. Your job is to resolve ambiguous 'upcoming' and 'next' references into explicit date ranges.

## Input
- User Query: [USER_QUERY]
- Reference Date (today): [REFERENCE_DATE]
- Week Start Day: [WEEK_START]
- Known Events: [EVENT_CATALOG]

## Task
1. Identify all temporal expressions in the query that use 'upcoming', 'next', or similar forward-looking language.
2. For each expression, classify the user's intent as one of:
   - `immediate_next`: The single soonest occurrence after the reference date.
   - `calendar_next`: The occurrence in the next calendar period (next week, next month, next quarter).
   - `upcoming_window`: A forward-looking range containing multiple possible occurrences.
   - `named_event`: A reference to a known event from the catalog.
3. Resolve each expression to an explicit date range with start and end dates in ISO 8601 format (YYYY-MM-DD).
4. If the intent is ambiguous, provide the most likely resolution and flag the ambiguity.

## Constraints
- Always use the reference date as the anchor. Do not use the current system date.
- For 'next [weekday]': if today is that weekday, 'next' means the weekday in the next calendar week unless the query says 'today' or 'this [weekday]'.
- For 'upcoming [event]': check the event catalog first. If not found, treat as a 30-day forward window from the reference date.
- If the query contains no temporal expression, return an empty resolutions array.
- Never invent event dates not present in the catalog.

## Output Schema
Return valid JSON matching this structure:
[OUTPUT_SCHEMA]

## Examples
[EXAMPLES]

Adaptation guidance: Replace [USER_QUERY] with the raw user input. Set [REFERENCE_DATE] to the conversation's temporal anchor—typically the current date in the user's timezone, not UTC now. Populate [EVENT_CATALOG] with a JSON array of known events, each containing a name, date, and optional recurrence rule. Define [OUTPUT_SCHEMA] as a JSON Schema object that includes fields for resolutions (array of objects with expression, intent_class, start_date, end_date, confidence, and ambiguity_flag). Provide [EXAMPLES] as 2-3 few-shot demonstrations covering the most common disambiguation cases in your domain. If your application handles high-stakes scheduling (medical appointments, legal deadlines, financial transactions), add a [RISK_LEVEL] parameter and require explicit human confirmation when confidence falls below a threshold. Test this prompt against edge cases: Monday referencing 'next Friday', month-boundary rollover, leap years, and queries containing both 'this' and 'next' for the same entity type.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Upcoming and Next Temporal Intent Disambiguation Prompt. Each variable must be validated before the prompt is assembled to prevent boundary errors and ambiguous date ranges.

PlaceholderPurposeExampleValidation Notes

[USER_QUERY]

The raw temporal expression to disambiguate

next Friday

Must be non-empty string; reject null or whitespace-only input

[REFERENCE_DATE]

The anchor date for resolving relative time expressions

2025-03-24

Must parse as valid ISO 8601 date; reject if missing or unparseable

[TIMEZONE]

IANA timezone identifier for boundary calculation

America/New_York

Must match IANA timezone database; default to UTC if null; validate against known identifiers

[EVENT_CALENDAR]

Optional list of known upcoming events with dates for event-driven anchoring

[{"event": "earnings call", "date": "2025-04-15"}]

If provided, each entry must have non-empty event and valid date; null allowed when no event context exists

[WEEK_START_DAY]

Day considered the start of the week for boundary logic

Monday

Must be one of Monday through Sunday; default to Monday if null; case-insensitive match

[INTENT_CLASSES]

Allowed intent classification labels for output

["immediate_next", "future_period", "ambiguous"]

Must be non-empty array of strings; reject if empty; validate against known intent taxonomy

[OUTPUT_SCHEMA]

Expected JSON structure for the disambiguation result

{"intent": "string", "date_range_start": "string", "date_range_end": "string", "confidence": "float"}

Must be valid JSON schema; reject malformed schemas; confidence field must accept 0.0-1.0 range

[MAX_FUTURE_WINDOW_DAYS]

Upper bound in days for how far forward to resolve future periods

90

Must be positive integer; reject zero or negative values; null triggers default of 365 days

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the temporal intent disambiguation prompt into a calendar or scheduling RAG pipeline with validation, retries, and logging.

The Upcoming and Next Temporal Intent Disambiguation Prompt is designed to sit between the user's natural language query and the retrieval or calendar API call. Its job is to resolve ambiguous references like 'next Friday' or 'upcoming earnings' into a concrete classification (IMMEDIATE_NEXT or FUTURE_PERIOD) and a corresponding date range. This classification must happen before any downstream search or scheduling action, because the wrong interpretation silently produces results that look correct but are temporally wrong. The prompt should be called as a dedicated pre-retrieval step, not folded into a larger answer-generation prompt where temporal reasoning can be diluted by other instructions.

Wire the prompt into your application as a synchronous pre-processing function. Accept the user query string and a reference datetime (typically now() in the user's timezone) as inputs. The prompt returns a structured JSON object with intent_class, date_range_start, date_range_end, and confidence. Before passing this output to your retrieval system, validate it: confirm that date_range_start is before date_range_end, that the range is not in the past for IMMEDIATE_NEXT classifications (unless the reference time is very close to the boundary), and that confidence meets your minimum threshold (start with 0.7 and tune based on eval results). If validation fails, log the failure with the original query, the raw model output, and the validation error, then either fall back to a safe default range or surface a clarification question to the user. For high-stakes scheduling applications, add a human review step when confidence is below 0.85 or when the classification flips between IMMEDIATE_NEXT and FUTURE_PERIOD on retry.

Choose a model with strong instruction-following and JSON output capabilities. GPT-4o, Claude 3.5 Sonnet, and Gemini 2.0 Flash all perform well on this structured classification task. Set temperature=0 to minimize variance in boundary decisions. Implement a single retry with exponential backoff if the output fails JSON schema validation or if the model returns a confidence below your threshold on the first attempt. Log every invocation with the query, reference datetime, model response, validation result, and final date range for debugging weekday-boundary and event-anchoring edge cases. Avoid calling this prompt inside a loop or agentic planner without caching results for identical query-reference pairs, as temporal resolution is deterministic given the same inputs and repeated calls waste tokens.

IMPLEMENTATION TABLE

Expected Output Contract

The expected JSON structure for the disambiguation result. Validate this contract before passing the output to a downstream date-range resolver or retrieval filter builder.

Field or ElementType or FormatRequiredValidation Rule

intent_classification

string enum: ["immediate_next", "upcoming_period"]

Must match one of the allowed enum values exactly. Reject any other string.

confidence_score

number (0.0 to 1.0)

Must be a float between 0.0 and 1.0 inclusive. If below 0.7, flag for human review or clarification prompt.

resolved_start_date

string (ISO 8601 date: YYYY-MM-DD)

Must parse as a valid date. Must not be in the past for 'immediate_next' intent relative to [REFERENCE_DATE].

resolved_end_date

string (ISO 8601 date: YYYY-MM-DD)

Must parse as a valid date. Must be greater than or equal to resolved_start_date.

disambiguation_rationale

string

Must be a non-empty string explaining the choice. Max 300 characters. Should reference the specific weekday or event anchor used.

alternative_interpretation

object or null

If not null, must contain 'intent' (string) and 'date_range' (object with 'start' and 'end' ISO 8601 strings). Represents the rejected interpretation.

assumed_reference_date

string (ISO 8601 date: YYYY-MM-DD)

Must equal the [REFERENCE_DATE] input. Validates that the prompt did not hallucinate a different anchor.

PRACTICAL GUARDRAILS

Common Failure Modes

Temporal intent disambiguation fails silently in production. These are the most common breakages when resolving 'upcoming' and 'next' references, with concrete guardrails to catch them before retrieval executes.

01

Weekday Boundary Drift Near Midnight

What to watch: When the reference time is near midnight or in a different timezone than the user, 'next Friday' resolves to the wrong calendar date. The model applies the reference date's weekday logic but the actual 'now' has already crossed the boundary. Guardrail: Always inject an explicit reference timestamp with timezone offset into the prompt. Validate the resolved date against a deterministic weekday calculation before retrieval.

02

Underspecified Event Anchoring

What to watch: Queries like 'upcoming earnings' or 'next release' fail when the model doesn't know which entity's earnings or which product's release is intended. The prompt hallucinates an anchor or defaults to an irrelevant calendar. Guardrail: Require an explicit event context or entity identifier as a required input. If missing, the prompt should return a clarification request rather than guessing the anchor.

03

Immediate vs. Next-Period Confusion

What to watch: 'Next Friday' on a Thursday can mean tomorrow (the immediately upcoming Friday) or the Friday of next week, depending on regional and personal convention. The model defaults to one interpretation without signaling ambiguity. Guardrail: Prompt the model to output both interpretations with labeled confidence scores when the reference date is within 48 hours of the target. Let the application layer decide or ask the user.

04

Fiscal Calendar Misalignment

What to watch: 'Upcoming quarter' or 'next fiscal year' resolves to calendar boundaries when the corpus uses a non-standard fiscal calendar. Retrieval returns documents from the wrong reporting period. Guardrail: Accept an optional fiscal calendar definition as input. When provided, validate that resolved boundaries align with the fiscal period start/end rather than calendar months.

05

Silent Null Returns on Ambiguous Input

What to watch: The prompt produces a date range for 'next month' but the user meant a project milestone called 'Next Month' or an event code. The resolved range is technically valid but semantically wrong, and retrieval returns irrelevant documents without any error signal. Guardrail: Include a disambiguation check in the output schema. Require the model to classify whether the temporal expression is a literal date reference or a named entity before resolving.

06

Recurring Event Instance Selection

What to watch: 'Upcoming board meeting' when meetings recur monthly. The model picks the next calendar occurrence but the user meant the next quarterly review meeting, which follows a different schedule. Guardrail: When a recurring event schedule is available, pass it as context and instruct the model to match against known instances. If no schedule is provided, output the assumption explicitly so downstream systems can flag mismatches.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to evaluate the quality of the Upcoming and Next Temporal Intent Disambiguation Prompt before deploying it in a production RAG system. Each criterion targets a specific failure mode common to temporal intent resolution.

CriterionPass StandardFailure SignalTest Method

Intent Classification Accuracy

Correctly labels the query as 'immediate upcoming' or 'future period' for 95% of test cases.

Misclassifies 'next Friday' as a future period when today is Monday, or misclassifies 'upcoming earnings season' as immediate.

Run a golden dataset of 50 labeled queries with known reference dates and verify classification against expected labels.

Date Range Boundary Precision

Generated date range boundaries match the ground truth exactly for unambiguous queries.

Off-by-one errors on week boundaries, month-end rollover, or event-anchored ranges.

Assert that the output [START_DATE] and [END_DATE] match pre-calculated ISO 8601 values for each test case.

Weekday Boundary Logic

When today is Friday and the query is 'next Friday', the output resolves to 7 days from now, not today.

Resolves 'next [weekday]' to the current day when the current day matches the target weekday.

Create a test matrix of all 7 weekdays as reference dates with 'next [weekday]' queries and verify each output.

Event-Driven Anchor Resolution

When the query references an event like 'upcoming earnings', the output uses the correct event date from the provided [EVENT_CALENDAR] context.

Uses a generic calendar date instead of the provided event date, or hallucinates an event date not in the context.

Provide a mock [EVENT_CALENDAR] with known dates and verify the output range aligns with the next event occurrence.

Ambiguity Handling and Default Behavior

When intent is genuinely ambiguous, the output includes a [CONFIDENCE_SCORE] below the threshold and a [CLARIFICATION_NEEDED] flag set to true.

Assigns high confidence to an ambiguous resolution or fails to signal that clarification is required.

Feed queries with known ambiguity (e.g., 'next review' with no context) and check that [CONFIDENCE_SCORE] < 0.7 and [CLARIFICATION_NEEDED] is true.

Reference Date Adherence

All date calculations use the provided [REFERENCE_DATE] and not the model's training cutoff or system clock.

Output dates that are anchored to the current system date rather than the provided [REFERENCE_DATE] placeholder value.

Set [REFERENCE_DATE] to a past date (e.g., 2023-06-15) and verify that 'next month' resolves to July 2023, not the current month.

Output Schema Compliance

The output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed.

Missing [INTENT_CLASS], malformed [DATE_RANGE], or extra fields not in the schema.

Validate the output against the JSON Schema definition programmatically after each test run.

Edge Case: End-of-Year Rollover

Queries like 'next January' in December resolve to the following calendar year.

Resolves 'next January' in December to the current year's January, which is in the past.

Test with [REFERENCE_DATE] set to December 15 and query 'next January'; assert the output year is the following year.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt\nStart with the base prompt and a single reference date. Skip strict schema validation and focus on intent classification accuracy. Use a small eval set of 20–30 ambiguous queries with known ground-truth intent labels.\n\n```\n[QUERY]: next Friday\n[REFERENCE_DATE]: 2025-03-10\n[OUTPUT]: {\"intent\": \"immediate_next\", \"date_range\": \"2025-03-14/2025-03-14\"}\n```\n\n### Watch for\n- Weekday boundary logic errors when reference date is the same weekday\n- Event-anchored references (e.g., 'next earnings') resolving to dates without event context\n- Missing confidence scores making it hard to spot ambiguous cases

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.