Module 3 - Ungraded Lab: Turning functions into tools - tools definition

In section 3.4, the tools is defined as follows:
tools = [{
“type”: “function”,
“function”: {
“name”: “get_current_time”, # <— Your functions name
“description”: “Returns the current time as a string.”, # <— a description for the LLM
“parameters”: {}
}
}]
But in section 4.2, the tools is defined differently as follows:
tools=[
get_current_time,
get_weather_from_ip,
write_txt_file,
generate_qr_code
],

So what does it mean to pass function names to the tools array? How is the OpenAI model going to handle these function names?

Thanks in advance

In the first example, you are explicitly defining the tool, including its name, description, and parameters, so the model knows what the tool does and when to use it.

In the second example, you are passing a list of already-defined tools (functions) that the model can use. The SDK handles the tool definitions and makes them available to the model. The model can then decide which tool to call based on the user’s request.