While using the new OpenAI library version 1.3.7 function calling is not working.I am seeing the below error using the code below.
Error:
openai.NotFoundError: Error code: 404 - {'error': {'message': 'Unrecognized request argument supplied: functions', 'type': 'invalid_request_error', 'param': None, 'code': None}}
import osimport jsonfrom openai import AzureOpenAIclient = AzureOpenAI( azure_endpoint="https://neyahopenai.openai.azure.com/", api_version="2023-07-01-preview", api_key=os.environ["OPENAI_API_KEY"])def get_stock_price(symbol): """Get the current stock price for given symbol""" stock_info = { "symbol": symbol, "price": "1000" } return json.dumps(stock_info)functions = [ { "name": "get_stock_price", "description": "Get the current stock price for the given symbol", "parameters": { "type": "object", "properties": { "symbol": { "type": "string", "description": "The symbol, e.g. AAPL", } }, "required": ["symbol"], }, }]messages = [{'role': 'user', 'content': 'Get stock symbol and price for Apple'}]response = client.chat.completions.create( model="text_demo", messages=messages, functions=functions, function_call="auto")response_message = response.choices[0].messageprint(response_message)