Skip to main content
Vintl responses are designed to work as function calling output. String-typed values avoid floating-point ambiguity in LLM reasoning, and the consistent envelope fits in context windows without preprocessing.

Tool definition

Here’s a tool definition that works with OpenAI, Anthropic, or any framework that supports JSON Schema:
tool_definition.py
tool = {
    "type": "function",
    "function": {
        "name": "query_economic_data",
        "description": "Get macro-economic data (GDP, CPI, unemployment, etc). "
                       "Use as_of to get data as it was known on a specific date.",
        "parameters": {
            "type": "object",
            "properties": {
                "series_id": {
                    "type": "string",
                    "description": "GDPC1=GDP, CPIAUCSL=CPI, UNRATE=unemployment, "
                                   "PAYEMS=payrolls, FEDFUNDS=fed funds rate"
                },
                "as_of": {
                    "type": "string",
                    "description": "Date (YYYY-MM-DD). Returns data as known on this date. "
                                   "Omit for latest values."
                },
                "limit": {
                    "type": "integer",
                    "description": "Number of observations (default 5, max 1000)"
                }
            },
            "required": ["series_id"]
        }
    }
}

Implementation

tools.py
import os
import requests

def query_economic_data(series_id: str, as_of: str = None, limit: int = 5) -> dict:
    params = {"limit": limit}
    if as_of:
        params["as_of"] = as_of

    resp = requests.get(
        f"https://api.vintl.io/v1/series/{series_id}/observations",
        headers={"X-API-Key": os.environ["VINTL_API_KEY"]},
        params=params
    )
    return resp.json()
When the model calls query_economic_data(series_id="GDPC1", as_of="2023-10-26"), it gets back exactly what GDP was when the advance estimate was published — not today’s revised number. This matters for any agent reasoning about historical economic conditions.

Treasury yields tool

tools.py
def query_yield_curve(date: str = None) -> dict:
    params = {}
    if date:
        params["date"] = date

    resp = requests.get(
        "https://api.vintl.io/v1/treasury/yields/curve",
        headers={"X-API-Key": os.environ["VINTL_API_KEY"]},
        params=params
    )
    return resp.json()

Why as_of matters for agents

Without as_of, an agent answering “what did the economy look like in October 2023?” gets today’s revised data. The GDP number it sees ($22,841B) is $349B higher than what anyone actually knew in October 2023 ($22,492B). For agents making decisions, generating analysis, or answering historical questions, as_of prevents hallucinating knowledge that didn’t exist yet.

Available series

Series IDDescriptionFrequency
GDPC1Real GDPQuarterly
CPIAUCSLConsumer Price IndexMonthly
UNRATEUnemployment RateMonthly
PAYEMSNonfarm PayrollsMonthly
FEDFUNDSFederal Funds RateMonthly
INDPROIndustrial ProductionMonthly
HOUSTHousing StartsMonthly
PCEPIPCE Price IndexMonthly
Use GET /v1/series?q=inflation to discover more. See the API Reference for the full endpoint documentation.
Last modified on March 29, 2026