let spec = {
name: "getPopulation",
description:
"Find the population of a given state. The state is represented by an ID named stateId. The user will give a state name and the corresponding stateId needs to be obtained",
parameters: {
type: "object",
properties: {
stateId: {
type: "integer",
description: "The ID of the state",
enum: [
{ value: 1, description: "Alabama" },
{ value: 2, description: "Alaska" },
{ value: 3, description: "Arizona" },
{ value: 4, description: "Arkansas" },
{ value: 5, description: "California" },
],
},
},
required: ["stateId"],
},
};
export default spec;
I am trying to get the stateId based on the users query
What is the population of Alabama?
I was hoping it would give the function call response like below
I’ve never seen this documented. Every other example I’ve seen specifies enums as strings without a description, such as enum: [ "Alabama", "Alaska" ]. Is this something you’ve seen officially documented, or was it just a guess? It’s never clear with LLMs how much of the API is fixed and how much is just a suggestion to be interpreted by the LLM itself!
6.1.2 enum
The value of this keyword MUST be an array. This array SHOULD have at least one element. Elements in the array SHOULD be unique.
...
Elements in the array might be of any type, including null.
I’m a bit new to ChatGPT functions and I’m curious – would the difference in styling between the following create any difference in performance as far as ChatGPT’s selection of the parameter? I see from the function calling documentation that it can hallucinate answers as well. Any thoughts on this would be appreciated.