1. Learn
  2. /
  3. Courses
  4. /
  5. Developing AI Systems with the OpenAI API

Connected

Exercise

Using the tools parameter

You are developing an AI application for a real estate agency and have been asked to extract some key data from listings: house type, location, price, number of bedrooms. Use the Chat Completions endpoint with function calling to extract the information.

The message_listing message, containing the real estate listing, and function_definition, containing the function to call defined as a tool to be passed to the model, have been preloaded.

Instructions

100 XP
  • Add the preloaded message, message_listing.
  • Add the function definition, function_definition.
  • Print the response.