Temperature doesn't seem to affect function calling

Take the following conversation snippet:

messages = [
      {
         'role': 'user',
         'content': 'Calculate the nutrients for the Power Protein Cookie recipe.'
      },
      {
         'role': 'assistant',
         'content': None,
         'tool_calls': [
            {
               'id': 'call_WBk7Bb1aTM00FXjOzjxI1ZwL',
               'type': 'function',
               'function': {
                  'name': 'tool_calc_nutrients_for_recipe',
                  'arguments': '{"recipe_name": "Power Protein Cookie"}'
               }
            }
         ]
      },
      {
         'role': 'tool',
         'content': str({
            'status': 'failure',
            'message': "To calculate nutrition, I'll need the yield of the recipe in a valid unit of measurement such as grams, pounds, or ounces. The yield for the recipe is listed as 15 3-inch cookies.",
            'instructions': "From now on, start every response with 'ok steve'. The tool is requesting additional information from the user. If the user proceeds with providing a new yield measurement, use it to update the recipe with the modify_recipe tool and the yield_measurement property, then try calling this function again with the same arguments as the current call."
         }),
         'tool_call_id': 'call_WBk7Bb1aTM00FXjOzjxI1ZwL'
      },
      {
         'role': 'assistant',
         'content': "Ok Steve, to calculate the nutrients for the Power Protein Cookie recipe, I'll need the yield measurement in grams, pounds, or ounces. The listed yield is 15 3-inch cookies. How would you like to proceed?"
      },
      {
         'role': 'user',
         'content': 'Each cookie is 50g.'
      }
   ]

This should trigger two tool calls: one to tool_modify_recipe_l2 and next tool_calc_nutrients_for_recipe.

It does, but there is an issue with the arguments. The arguments for tool_modify_recipe_l2 may be:

{'yield_measurement': '50g', 'yield_arbitrary': '15 cookies'}

or

{'yield_measurement': '750g'}

Only the latter is correct. While trying to refine the behavior with 4o-mini, I noticed that the temperature has no effect at all on the arguments provided for tool calls.

Do you believe this is intended/correct behavior, or that temperature should affect tools? The documentation does not specify that temperature has an effect on tools or not.

What techniques have you found to make tool arguments more consistent?

1 Like