Preparing data to fine-tune function-calling model

I’ve been using a fine-tuned model before that I trained with examples. Model was used exclusively with function calling. It was classifying the text and extracting an entity.

It looks like JSON payload for calls using fine-tuning will change soon, as “function” figures as “Deprecated” in the documentation (even though it still works).

I’m preparing to train a new model and looking into getting examples uploaded. However, the documentation doesn’t seem to be up to date and I’m struggling to determine right format for the JSONL file.

Previously it was:

{
    "messages": [
        {"role": "user", "content": "What is the weather in San Francisco?"},
        {"role": "assistant", "function_call": {"name": "get_current_weather", "arguments": "{\"location\": \"San Francisco, USA\", \"format\": \"celcius\"}"}}
        {"role": "function", "name": "get_current_weather", "content": "21.0"},
        {"role": "assistant", "content": "It is 21 degrees celsius in San Francisco, CA"}
    ],
    "functions": [...] // same as before
}

The above example mentions deprecated “functions”:

How should my example look like now?

2 Likes

If you upload training data using the tools schema, you get the following error on file upload:

BadRequestError: Error code: 400 - {'error': {'message': 'Invalid file format. Line 1, message 11, key "__root__": At least one of content or function_call must be set.', 'type': 'invalid_request_error', 'param': None, 'code': None}}

Training 3.5-1106 using the old schema (functions/function_call) caused weird behavior when testing the model.

I’ve noticed the same old behavior. Fine-Tunings files validation process seems to be not updated to new API profiles. Until it won’t be we’ll couldn’t use new API profile ( “tool_calls:” specification ).