openai-cookbook icon indicating copy to clipboard operation
openai-cookbook copied to clipboard

Missing required parameter: 'tools[0].type'

Open bythyag opened this issue 1 year ago • 1 comments
trafficstars

The code in the problem example: examples/Fine_tuning_for_function_calling.ipynb runs into an error while using the prompt. It shows the following error:

---------------------------------------------------------------------------
BadRequestError                           Traceback (most recent call last)
[<ipython-input-11-d1957f1085c7>](https://piu8dppdgn8-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240606-060106_RC00_640854796#) in <cell line: 6>()
      8   messages.append({"role": "system", "content": DRONE_SYSTEM_PROMPT})
      9   messages.append({"role": "user", "content": prompt})
---> 10   completion = get_chat_completion(model="gpt-3.5-turbo",messages=messages,tools=function_list)
     11   print(prompt)
     12   print(completion.function_call,'\n')

5 frames
[/usr/local/lib/python3.10/dist-packages/openai/_base_client.py](https://piu8dppdgn8-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240606-060106_RC00_640854796#) in _request(self, cast_to, options, remaining_retries, stream, stream_cls)
   1018 
   1019             log.debug("Re-raising status error")
-> 1020             raise self._make_status_error_from_response(err.response) from None
   1021 
   1022         return self._process_response(

BadRequestError: Error code: 400 - {'error': {'message': "Missing required parameter: 'tools[0].type'.", 'type': 'invalid_request_error', 'param': 'tools[0].type', 'code': 'missing_required_parameter'}}

bythyag avatar Jun 09 '24 03:06 bythyag