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”:
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 ).
Added a message to the docs, but the current state is: " function_call and functions have been deprecated in favor of tools , however, the fine-tuning API still requires the legacy format at this time."
The function method can be used to train AI models. It is required to be in a special assistant format because OpenAI doesn’t want to disclose the actual language the AI generates to the API’s tool recipient code (hint: and has disabled spaces in role names so you can’t quite get there).
The language that you train the AI on will be the same even if you plan on “tools”. The only thing not exposed is having the AI make multiple tools calls at once, which has AI write more with undisclosed prompting. You should be able to utilize the fine-tune model with either “function” or “tool” method.
gpt-3.5-turbo shouldn’t actually need fine-tune training on emitting functions, unless you have a very specific stylistic or behavioral choice that must be enclosed in them. OpenAI says in the guide that then you don’t need to include full function definitions then, but the API actually requires functions or tools definitions still be passed or you get nothing.
Note: fine-tune with function currently has a fault in that it trains the AI wrong on terminating normal output or such, resulting in repeating lines. More workaround is needed.
My team is struggling to get functions to not execute before all arguments are available. Structurally, we need gpt-3.5-turbo to wait and not hallucinate function arguments. Thus we are using fine tuning. The function in question is one that collects a user’s message (name, phone, body) which to me seems toy.
Correct me if I am misunderstanding you, but are you suggesting that this is the incorrect approach?
Only functions is currently supported by fine-tune.
Parallel tool calls requires an additional tool to be manually placed into the tools section, that they wanted to not disclose, and the multi_tool_use call and return value uses a significantly larger number of tokens when emitted and then replayed to the AI.
You can train your AI on iteratively using functions, by placing an extended conversation with multiple turns, for example where AI does a search and then accesses the results of the search.