OpenAI Types
ChatCompletionTool
1interface ChatCompletionTool {
2 function: FunctionDefinition;
3 /**
4 * The type of the tool. Currently, only `function` is supported.
5 */
6 type: 'function';
7}
ChatCompletionTool
1interface FunctionDefinition {
2 /**
3 * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
4 * underscores and dashes, with a maximum length of 64.
5 */
6 name: string;
7
8 /**
9 * A description of what the function does, used by the model to choose when and
10 * how to call the function.
11 */
12 description?: string;
13
14 /**
15 * The parameters the functions accepts, described as a JSON Schema object. See the
16 * [guide](https://platform.openai.com/docs/guides/text-generation/function-calling)
17 * for examples, and the
18 * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
19 * documentation about the format.
20 *
21 * Omitting `parameters` defines a function with an empty parameter list.
22 */
23 parameters?: FunctionParameters;
24}
1namespace ChatCompletionMessageToolCall {
2 /**
3 * The function that the model called.
4 */
5 export interface Function {
6 /**
7 * The arguments to call the function with, as generated by the model in JSON
8 * format. Note that the model does not always generate valid JSON, and may
9 * hallucinate parameters not defined by your function schema. Validate the
10 * arguments in your code before calling your function.
11 */
12 arguments: string;
13
14 /**
15 * The name of the function to call.
16 */
17 name: string;
18 }
19}
FunctionParameters
1type FunctionParameters = Record<string, unknown>;