Skip to main content

Current Date Fetching

Runbear provides a date fetching tool that allows your OpenAI Assistants to fetch the current date, enabling responses to queries involving relative dates, such as “Show me the data from the past week.”

Use Cases

  • Answer questions that involve relative dates, e.g., “How many visitors did we get in the past week?” use case
  • Generate reports based on recent data.

⋯ And much more!

How to Use Current Date Fetching

The date fetching tool uses OpenAI Assistant’s Function Calling tool.

  1. Open the OpenAI Assistants form.
  2. Click the “+ Functions” button next to the “Functions” section.
add-functions
  1. Copy and paste this function definition, then adjust the description fields to suit your requirements.
{
"name": "plugbear_get_current_date",
"description": "This function returns the current date.",
"parameters": {
"type": "object",
"properties": {
"timezone": {
"type": "string",
"description": "TODO: The timezone to get the current date in. e.g., America/Los_Angeles"
}
},
"required": ["timezone"]
}
}
note

Ensure that the function name is plugbear_get_current_date.

  1. Click the “Save” button to add the function.

Your assistant can now fetch and utilize the current date, enabling it to handle queries involving relative dates and perform tasks such as generating timely reports and answering date-related questions.