john-adeojo / autogen_flights_tutorial

Tutorial for AutoGen with Amadeus flights API, Parallel Function Calls
41 stars 23 forks source link

When tried with gpt-3.5-turbo-16k Cannot Use Function Calling #1

Open yigit353 opened 11 months ago

yigit353 commented 11 months ago

The project works excellently with gpt-4-turbo, although with some hiccups.

When I change the model to gpt-3.5-turbo-16k, I get the error below. Is that a known issue of the AutoGEN, or is there something I should change too?

***** Response from calling function "data_retreiver.getCode" *****
Error: Function data_retreiver.getCode not found.

The error is caused by this

chat_manager (to chat_manager):

Show me the cheapest flights from Istanbul Airport to Amsterdam, leaving on the
    21st of December 2023 and returning on the 23rd of December 2023.

--------------------------------------------------------------------------------
data_retriever (to chat_manager):

***** Suggested function Call: data_retreiver.getCode *****
Arguments: 
{
  "originLocationCode": "IST",
  "destinationLocationCode": "AMS",
  "departureDate": "2023-12-21",
  "returnDate": "2023-12-23",
  "adults": 1,
  "maxPrice": 0,
  "max": 10
}
***********************************************************

--------------------------------------------------------------------------------
user_proxy (to chat_manager):

***** Response from calling function "data_retreiver.getCode" *****
Error: Function data_retreiver.getCode not found.
*******************************************************************

...

BadRequestError: Error code: 400 - {'error': {'message': "'data_retreiver.getCode' does not match '^[a-zA-Z0-9_-]{1,64}$' - 'messages.2.function_call.name'", 'type': 'invalid_request_error', 'param': None, 'code': None}}

gpt-4-turbo generates the correct function call while gpt-3.5-turbo makes up inexisting function:

***** Suggested function Call: get_flight_data *****
john-adeojo commented 11 months ago

Hmm, to be honest I'm not completely sure where this error is coming from. Did you change the model in the configuration file too?

yigit353 commented 11 months ago

configurations.json

[
        {
            "model": "gpt-3.5-turbo-16k-0613",
            "api_key": "sk-xxxxxxxxxxxxxx"
        } ,
        {
            "model": "gpt-4-1106-preview",
            "api_key": "sk-yyyyyyyyyyyyyyyy"
        } 
    ]

I even used different API keys for both models. And in the notebook:

config_list = autogen.config_list_from_json(
    env_or_file="configurations.json",
    file_location=configurations_path,
    filter_dict={
        # "model": ["gpt-4-1106-preview"],
        "model": ["gpt-3.5-turbo-16k-0613"]
    },
)

It makes a call to gpt3.5-turbo-16k, I can confirm it from the usage:

image

However, even though I changed the seed and temperature for the data retriever agent, it made up the same wrong function calls every time.

llm_config_data_retriever = {
    "functions":get_flight_data_functions,
    "config_list": config_list,
    "seed": 150,
    "temperature": 0.2
}