You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
51
+
*/
52
+
name: string;
53
+
/**
54
+
* _Optional_
55
+
*
56
+
* The description of what the function does.
57
+
*/
58
+
description?: string;
59
+
/**
60
+
* _Optional_
61
+
*
62
+
* The parameters the functions accepts, described as a JSON Schema object.
63
+
* See the {@link https://platform.openai.com/docs/guides/gpt/function-calling guide} for examples, and the {@link https://json-schema.org/understanding-json-schema/ JSON Schema reference} for documentation about the format.
64
+
*/
65
+
parameters?: object;
18
66
};
19
67
/** Request body */
20
68
exporttypeReqBody={
@@ -23,13 +71,30 @@ export type ReqBody = {
23
71
*
24
72
* ID of the model to use. See the {@link https://platform.openai.com/docs/models/model-endpoint-compatibility model endpoint compatibility} table for details on which models work with the Chat API.
* The messages to generate chat completions for, in the {@link https://platform.openai.com/docs/guides/chat/introduction chat format}.
31
79
*/
32
80
messages: Array<Message>;
81
+
/**
82
+
* _Optional_
83
+
*
84
+
* A list of functions the model may generate JSON inputs for.
85
+
*/
86
+
functions?: Array<FunctionModel>;
87
+
/**
88
+
* _Optional_
89
+
*
90
+
* Controls how the model responds to function calls. "none" means the model does not
91
+
* call a function, and responds to the end-user.
92
+
* "auto" means the model can pick between an end-user or calling a function.
93
+
* Specifying a particular function via `{"name":\ "my_function"}`
94
+
* forces the model to call that function. "none" is the default when no functions are present.
95
+
* "auto" is the default if functions are present.
96
+
*/
97
+
function_call?: string|object;
33
98
/**
34
99
* _Optional. Defaults to 1_
35
100
*
@@ -46,7 +111,7 @@ export type ReqBody = {
46
111
* considers the results of the tokens with top_p probability mass. So 0.1 means only the
47
112
* tokens comprising the top 10% probability mass are considered.
48
113
*
49
-
* We generally recommend altering this or temperature but not both.
114
+
* We generally recommend altering this or `temperature` but not both.
50
115
*/
51
116
top_p?: number;
52
117
/**
@@ -70,8 +135,10 @@ export type ReqBody = {
70
135
/**
71
136
* _Optional. Defaults to inf_
72
137
*
73
-
* The maximum number of tokens allowed for the generated answer.
74
-
* By default, the number of tokens the model can return will be (4096 - prompt tokens).
138
+
* The maximum number of tokens to generate in the chat completion..
139
+
* The total length of input tokens and generated tokens is limited by the model's context length
140
+
*
141
+
* {@link https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb Example Python code} for counting tokens.
75
142
*/
76
143
max_tokens?: number;
77
144
/**
@@ -205,7 +272,7 @@ export declare class ChatGPT {
205
272
ORG: string|undefined;
206
273
URL: string;
207
274
MODEL: ReqBody['model'];
208
-
constructor({API_KEY,ORG,MODEL,}: {
275
+
constructor({API_KEY,ORG,URL,MODEL,}: {
209
276
/**
210
277
* The OpenAI API uses API keys for authentication.
211
278
* Visit your {@link https://platform.openai.com/account/api-keys API Keys} page to retrieve the API key you'll use in your requests.
@@ -234,7 +301,7 @@ export declare class ChatGPT {
234
301
/**
235
302
* ## .send(ReqBody | string, [RequestInit])
236
303
*
237
-
* Use this method to send request to ChatGPT API
304
+
* Use this method to send a request to ChatGPT API
238
305
*
239
306
* `RequestInit` is {@link https://www.npmjs.com/package/node-fetch#options node-fetch options}.
240
307
*
@@ -256,7 +323,7 @@ export declare class ChatGPT {
256
323
/**
257
324
* ## .stream(ReqBody | string, [RequestInit])
258
325
*
259
-
* Use this method to send request to ChatGPT API and get steam response back
326
+
* Use this method to send a request to ChatGPT API and get steam response back
260
327
*
261
328
* `RequestInit` is {@link https://www.npmjs.com/package/node-fetch#options node-fetch options}.
0 commit comments