#Function calling

1 messages · Page 1 of 1 (latest)

leaden forge
#

We use function calling to generate structured outputs.

In the toy example, the function is get_temperature. I want to implement something like extract_resume_information.

The difference here is that get_temperature is a tool that the LLM decides to use, whereas for extract_resume_information the LLM itself is the tool.

Does this matter?

Should I frame the tool as something like a tool where the LLM can use, e.g. save_resume_infromation instead of extract_resume_information

whole oliveBOT
#

Hi @leaden forge. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, the distinction between using the LLM as a tool itself versus using it to call external tools (like get_temperature) does not inherently affect the ability to structure function calls within the Chat Completions API. The key aspect to consider is how you define and present the function or tool to the model.

From the extracts, we see that OpenAI has transitioned from using functions to tools in their API, where tools are now the recommended way to specify functions the model may call to generate JSON inputs. This is highlighted in the forum post discussing the difference between functions and tools, where it's mentioned that functions have been deprecated in favor of tools (source (https://community.openai.com/t/603277)).

Given this, whether you're aiming to extract information from a resume or perform any other structured data operation, you should frame it as a tool that the model can use. The naming convention (save_resume_information vs. extract_resume_information) is less critical than ensuring that the tool is correctly defined and passed to the model in the format it expects.

For example, if you're implementing a tool to extract resume information, you would define it similarly to how you would with any other tool, ensuring it's listed under the tools parameter when making your API call. The model can then generate JSON inputs for this tool, which you can use to perform the desired operation in your code.

Remember, the model generates JSON that you can use to call the function in your code, but it does not execute the function itself. The execution and how you handle the JSON output is up to you (source (https://platform.openai.com/docs/guides/function-calling)).

#

In summary, whether you frame it as save_resume_information or extract_resume_information, the important part is that it's defined as a tool that the model knows how to generate inputs for. The distinction between the model being the tool or deciding to use a tool does not fundamentally change how you should approach defining and implementing the function call.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: