1. เรียนรู้
  2. /
  3. Courses
  4. /
  5. Working with the OpenAI Responses API

Connected

Exercises

Building the OpenAI Tool Definition

You've created the convert_timezone() function that uses the OpenTimezone API to convert datetimes between timezones. Now you need to create a tool definition in OpenAI's format so the LLM can understand how to use this function. The tool definition acts as a manual for the model, describing the function's purpose, parameters, and requirements.

คำแนะนำ

100 XP
  • Define a "function" type tool called "convert_timezone".
  • Create definitions for each of the function's three parameters: "date_time", "from_timezone", and "to_timezone".
  • Ensure that all three of the parameters are marked as required by the tool.