Is It possible to define the paramter/schema in agent

Is it possible to explicitly define the schema of paramters to reduce the hallucinations, this is a simple example for reference to do it in a main project.

import json
from dotenv import load_dotenv
from datetime import datetime
from swarm import Swarm, Agent

load_dotenv()

client = Swarm()

def calculate_age(**kwargs):
    print(kwargs)
    return json.dumps({"age": 20})
    """Calculate age based on the year of birth."""
    # current_year = datetime.now().year
    # year_of_birth = int(year_of_birth)  # Ensure the year_of_birth is an integer
    # age = current_year - year_of_birth
    # return json.dumps({"age": age})

parameters = {
    "type": "object",
    "properties": {
        "year_of_births": {
            "type": "string",  # Accepts year as a string
            "description": "The year of birth"
        }
    },
    "required": ["year_of_births"]  # Makes this parameter required
}

date_agent = Agent(
    name="Date and Age Agent",
    instructions="You are an agent that provides the current date and calculates age based on birth year.",
    functions=[calculate_age],
)

response_date = client.run(
    agent=date_agent,
    messages=[{"role": "user", "content": "What is the current date?"}],
)

print("Agent's Response (Date):", response_date)

response_age = client.run(
    agent=date_agent,
    messages=[{"role": "user", "content": "Assume I was born in 2004, what is my age?"}],
)

print("Agent's Response (Age):", response_age)