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)