Consider the following request:
{
"temperature":0.7,
"model":"gpt-3.5-turbo-0613",
"messages":[
{
"role":"user",
"content":"What's the 1337th prime?"
}
],
"functions":[
{
"name":"WolframAlpha",
"description":"Use natural language queries with Wolfram|Alpha to get up-to-date computational results about entities in chemistry, physics, geography, history, art, astronomy, and more.",
"parameters":{
"type":"object",
"properties":{
"query":{
"type":"string",
"description":"the query text used as input"
}
},
"required":["query"]
}
}
],
"function_call":"auto"
}
This almost always ends up in a function call to âpythonâ, which I have no way of handling in my client-side code (plus itâs just slow and inefficient, even if I could run it):
{
"id": "chatcmpl-7RNRoeOvNxdWjd47LvZfZB0jF4XO3",
"object": "chat.completion",
"created": 1686759344,
"model": "gpt-3.5-turbo-0613",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"function_call": {
"name": "python",
"arguments": "def is_prime(n):\n if n <= 1:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True\n\ndef nth_prime(n):\n count = 0\n num = 2\n while count < n:\n if is_prime(num):\n count += 1\n num += 1\n return num - 1\n\nnth_prime(1337)"
}
},
"finish_reason": "function_call"
}
],
"usage": {
"prompt_tokens": 91,
"completion_tokens": 111,
"total_tokens": 202
}
}
It seems like any type of computational problem almost always results in a python call, regardless of what functions youâve specified. For example, this also results in âpythonâ function calls:
{
"temperature":0.7,
"model":"gpt-3.5-turbo-0613",
"messages":[
{
"role":"user",
"content":"What's the 1337th prime?"
}
],
"functions":[
{
"name":"javascript",
"description":"Evaluate javascript code.",
"parameters":{
"type":"object",
"properties":{
"code":{
"type":"string",
"description":"the code to evaluate"
}
},
"required":["code"]
}
}
],
"function_call":"auto"
}
I ran that 100 times, and it only tried using the âjavascriptâ function once. Every other time it attempted to use âpythonâ.
This seems like a serious fundamental flaw.
Is this a bug?
What are my options here?