Limiting max_tokens field while using function calling

I want to use just the function call functionality of api so i want to decrease max_token count when i send requests to openai’s api. I just need called function’s name in response. Should i do something about this field or something?

1 Like

Can you run your question through ChatGPT and ask it translate your native text into English?

It might help you communicate your question more fluently :smiley:

They are asking if it’s possible to just use the relatively new function-calling feature to return either None or False if no function is to be called – or return the result of a function if a function was called, rather than also returning a response. In my experimentation, you’re unable to set max-tokens to a low number when using function-calling. This is something I was wondering as well.

Setting to a low number of tokens will indeed return the function called by the stimulation of the prompt and the environment - and just a bit more.

You must not actually execute or parse, which you can decide by “length” finish_reason - a good precaution to implement in any case.

  "message": {
    "role": "assistant",
    "content": null,
    "function_call": {
      "name": "python",
      "arguments": "def"
  "finish_reason": "length"

“usage”: {
“prompt_tokens”: 200,
“completion_tokens”: 6,
“total_tokens”: 206

only at four tokens do I get an server error processing the request, and you’ll have to tune by the function names to see how close you want to get.

But essentially no to the original idea. Any prompt that would try to ask what function would be called is input that affects what function would be called, and the choice is something that the AI can’t articulate.