Skip to main content
Milano is a text-guided forecasting model that combines time series data with natural language context. It uses an LLM to predict directional movements based on your scenario description, then leverages those predictions to improve the final forecast.

When to Use Milano

Use Milano when you have relevant textual information that could impact your forecast:
  • Upcoming events (promotions, holidays, product launches)
  • Known market conditions or external factors
  • Business context that isn’t captured in the numerical data
For purely numerical forecasting without text context, use Migas-1.0 instead.

Quick Example

from synthefy import SynthefyAPIClient
from synthefy.data_models import ForecastV2Request, SingleEvalSamplePayload

# Your time series data
samples = [[
    SingleEvalSamplePayload(
        sample_id="daily_sales",
        history_timestamps=["2024-01-01", "2024-01-02", "2024-01-03", "2024-01-04", "2024-01-05"],
        history_values=[1200, 1350, 1280, 1400, 1320],
        target_timestamps=["2024-01-06", "2024-01-07", "2024-01-08"],
        target_values=[None, None, None],
        forecast=True,
        column_name="sales",
        column_description="Daily retail sales in USD"
    )
]]

# Describe the scenario for the forecast period
text_contexts = [
    "A major competitor is launching a 30% discount campaign starting Jan 6th. "
    "Weather forecast shows heavy snow expected on Jan 7th which typically reduces foot traffic."
]

request = ForecastV2Request(
    samples=samples,
    model="milano",
    text_contexts=text_contexts
)

with SynthefyAPIClient(api_key="your_key", base_url="https://forecast.synthefy.com") as client:
    response = client.forecast(request)

Key Parameters

text_contexts

A list of strings, one per forecast scenario. Each string describes the context for that scenario’s forecast period.
# Single scenario
text_contexts = ["Holiday weekend expected to boost sales by 20-30%"]

# Multiple scenarios (one context per scenario)
text_contexts = [
    "Scenario 1: Normal operations",
    "Scenario 2: Major marketing campaign active"
]

column_description

Optional field on SingleEvalSamplePayload that helps Milano understand what each time series represents. This context is passed to the LLM alongside your text_contexts.
SingleEvalSamplePayload(
    sample_id="revenue",
    column_name="revenue",
    column_description="Monthly recurring revenue from enterprise subscriptions",
    # ... other fields
)

Multivariate Example

Milano works with multiple time series. Provide column_description for each to give the model full context:
samples = [[
    SingleEvalSamplePayload(
        sample_id="sales",
        history_timestamps=timestamps,
        history_values=sales_history,
        target_timestamps=target_dates,
        target_values=[None] * len(target_dates),
        forecast=True,
        column_name="sales",
        column_description="Daily unit sales for Product SKU-1234"
    ),
    SingleEvalSamplePayload(
        sample_id="price",
        history_timestamps=timestamps,
        history_values=price_history,
        target_timestamps=target_dates,
        target_values=[29.99, 24.99, 24.99],  # Known future prices
        forecast=False,
        metadata=True,
        leak_target=True,  # Future values are known
        column_name="price",
        column_description="Retail price in USD, will be discounted to $24.99 during promo"
    )
]]

text_contexts = [
    "Flash sale starting on the second forecast day with 17% price reduction. "
    "Email campaign to 50k subscribers scheduled for the same day."
]

request = ForecastV2Request(samples=samples, model="milano", text_contexts=text_contexts)

Tips for Effective Text Context

  1. Be specific: Include concrete numbers, dates, and percentages when available
  2. Focus on the forecast period: Describe what will happen during the target timestamps
  3. Include causally relevant information: Events that would logically impact your target variable
  4. Keep it concise: A few sentences is usually sufficient