scottsuhy
scottsuhy

Reputation: 405

fine-tuning and function calling not working for me. is it supported?

I fine-tuned a model 3 weeks ago using gpt-3.5-turbo which, I think, should have pulled the latest 3.5-turbo model:

job = openai.FineTuningJob.create(training_file=file_id, model="gpt-3.5-turbo")

and I'm trying to use function calling (see here) but I get an error that it's not supported:

"Error: Unrecognized request argument supplied: functions"

I read the following on here "Fine-tuning is most powerful when combined with other techniques such as prompt engineering, information retrieval, and function calling. Check out our fine-tuning guide to learn more. Support for fine-tuning with function calling and gpt-3.5-turbo-16k will be coming later this fall. "

does this mean that the model I fine-tuned does not support function calling or are they saying if you use gpt-3.5-turbo-16k specifically it's not in there? if that is the case, is there a model that I can fine-tune that does?

thanks in advance.

UPDATE: still not working I just retrained a model using model="gpt-3.5-turbo-0613" after reading this where it says "Snapshot of gpt-3.5-turbo from June 13th 2023 with function calling data. Unlike gpt-3.5-turbo, this model will not receive updates, and will be deprecated 3 months after a new version is released."

def start_fine_tuning(file_id):
    print("Starting the fine-tuning job...")
    job = openai.FineTuningJob.create(training_file=file_id, model="gpt-3.5-turbo-0613")
    print(f"Fine-tuning job {job['id']} started successfully!")
    return job

and it still does not recognize 'functions':

    functions = [
        {
            "name": "PriceTool",
            "description": "Fetch the current price.",
            "parameters": {
                "type": "object",
                "properties": {
                    "ticker": {
                        "type": "string",
                        "description": "The stock ticker symbol, e.g., AAPL for Apple Inc."
                    }
                },
                "required": ["ticker"]
            }
        }
    ]


    try:
        messages = [
            {"role": "system", "content": "This is a model that provides effects based on news or events."},
            {"role": "user", "content": f"{market_event}"},
            {"role": "user", "function": {
                "name": "PriceTool",
                "args": {
                    "ticker": "AAPL"  
                }
            }}
        ]
        response = openai.ChatCompletion.create(model=model_name, messages=messages, functions=functions)
        return response.choices[0].message["content"]
    except Exception as e:
        print(f"Error: {e}")
        return ""

Here is the Error: Additional properties are not allowed ('function' was unexpected) - 'messages.2' Failed to get a response from the model.

Upvotes: 0

Views: 823

Answers (1)

At the time of the original post, fine-tuning models with function calls wasn't possible.

However, OpenAI recently added examples of fine-tuning with function calls, which appears to be generally available now. Take a look: https://platform.openai.com/docs/guides/fine-tuning/fine-tuning-examples

Upvotes: 1

Related Questions